home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 12 - 1996 / 12.04 Apr 96 / ThreadingAppleEvents.sit / ThreadingAppleEvents / Grant's CGI Code 1.0b13 / Util / EventUtil.c < prev    next >
MacBinary  |  1996-01-26  |  16.4 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Fri Jan 26 00:40:45 1996, modified Fri Jan 26 00:40:45 1996, creator 'CWIE', type ASCII, 16110 bytes "EventUtil.c" , at 0x3f6e 454 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0b 45 76 65 6e 74 55 | 74 69 6c 2e 63 00 00 00 |..EventU|til.c...|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 00 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 3e ee 00 | 00 01 c6 ad 2e 19 dd ad |.....>..|........|
|00000060| 2e 19 dd 00 00 04 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 15 63 00 00 |........|.....c..|
|00000080| 2f 2a 2a 2a 2a 2a 0d 20 | 2a 0d 20 2a 09 45 76 65 |/*****. |*. *.Eve|
|00000090| 6e 74 73 2e 63 0d 20 2a | 0d 20 2a 09 54 68 69 73 |nts.c. *|. *.This|
|000000a0| 20 69 73 20 61 20 73 75 | 70 70 6f 72 74 20 66 69 | is a su|pport fi|
|000000b0| 6c 65 20 66 6f 72 20 22 | 47 72 61 6e 74 27 73 20 |le for "|Grant's |
|000000c0| 43 47 49 20 46 72 61 6d | 65 77 6f 72 6b 22 2e 0d |CGI Fram|ework"..|
|000000d0| 20 2a 09 50 6c 65 61 73 | 65 20 73 65 65 20 74 68 | *.Pleas|e see th|
|000000e0| 65 20 6c 69 63 65 6e 73 | 65 20 61 67 72 65 65 6d |e licens|e agreem|
|000000f0| 65 6e 74 20 74 68 61 74 | 20 61 63 63 6f 6d 70 61 |ent that| accompa|
|00000100| 6e 69 65 73 20 74 68 65 | 20 64 69 73 74 72 69 62 |nies the| distrib|
|00000110| 75 74 69 6f 6e 20 70 61 | 63 6b 61 67 65 0d 20 2a |ution pa|ckage. *|
|00000120| 09 66 6f 72 20 6c 69 63 | 65 6e 73 69 6e 67 20 64 |.for lic|ensing d|
|00000130| 65 74 61 69 6c 73 2e 0d | 20 2a 0d 20 2a 09 43 6f |etails..| *. *.Co|
|00000140| 70 79 72 69 67 68 74 20 | a9 31 39 39 35 20 62 79 |pyright |.1995 by|
|00000150| 20 47 72 61 6e 74 20 4e | 65 75 66 65 6c 64 0d 20 | Grant N|eufeld. |
|00000160| 2a 09 67 72 61 6e 74 40 | 61 63 6d 2e 63 6f 6d 0d |*.grant@|acm.com.|
|00000170| 20 2a 09 68 74 74 70 3a | 2f 2f 61 72 70 70 31 2e | *.http:|//arpp1.|
|00000180| 63 61 72 6c 65 74 6f 6e | 2e 63 61 2f 67 72 61 6e |carleton|.ca/gran|
|00000190| 74 2f 0d 20 2a 0d 20 2a | 2a 2a 2a 2a 2f 0d 0d 23 |t/. *. *|****/..#|
|000001a0| 69 6e 63 6c 75 64 65 20 | 22 4d 79 43 6f 6e 66 69 |include |"MyConfi|
|000001b0| 67 75 72 61 74 69 6f 6e | 2e 68 22 0d 0d 23 69 66 |guration|.h"..#if|
|000001c0| 20 6b 43 6f 6d 70 69 6c | 65 57 69 74 68 44 72 61 | kCompil|eWithDra|
|000001d0| 67 4e 44 72 6f 70 0d 23 | 69 6e 63 6c 75 64 65 20 |gNDrop.#|include |
|000001e0| 3c 44 72 61 67 2e 68 3e | 0d 23 65 6e 64 69 66 0d |<Drag.h>|.#endif.|
|000001f0| 2f 2f 23 69 6e 63 6c 75 | 64 65 20 3c 54 68 72 65 |//#inclu|de <Thre|
|00000200| 61 64 73 2e 68 3e 0d 0d | 23 69 6e 63 6c 75 64 65 |ads.h>..|#include|
|00000210| 20 22 63 6f 6d 70 69 6c | 65 72 5f 73 74 75 66 66 | "compil|er_stuff|
|00000220| 2e 68 22 0d 23 69 6e 63 | 6c 75 64 65 20 22 63 6f |.h".#inc|lude "co|
|00000230| 6e 73 74 61 6e 74 73 2e | 68 22 0d 23 69 6e 63 6c |nstants.|h".#incl|
|00000240| 75 64 65 20 22 67 6c 6f | 62 61 6c 73 2e 68 22 0d |ude "glo|bals.h".|
|00000250| 0d 23 69 6e 63 6c 75 64 | 65 20 22 41 62 6f 75 74 |.#includ|e "About|
|00000260| 42 6f 78 2e 68 22 0d 23 | 69 6e 63 6c 75 64 65 20 |Box.h".#|include |
|00000270| 22 44 65 62 75 67 55 74 | 69 6c 2e 68 22 0d 23 69 |"DebugUt|il.h".#i|
|00000280| 6e 63 6c 75 64 65 20 22 | 45 72 72 6f 72 55 74 69 |nclude "|ErrorUti|
|00000290| 6c 2e 68 22 0d 23 69 6e | 63 6c 75 64 65 20 22 4d |l.h".#in|clude "M|
|000002a0| 65 6e 75 46 75 6e 63 2e | 68 22 0d 2f 2f 23 69 6e |enuFunc.|h".//#in|
|000002b0| 63 6c 75 64 65 20 22 50 | 72 6f 63 65 73 73 55 74 |clude "P|rocessUt|
|000002c0| 69 6c 2e 68 22 0d 23 69 | 6e 63 6c 75 64 65 20 22 |il.h".#i|nclude "|
|000002d0| 51 75 69 74 2e 68 22 0d | 23 69 6e 63 6c 75 64 65 |Quit.h".|#include|
|000002e0| 20 22 57 69 6e 64 6f 77 | 49 6e 74 2e 68 22 0d 0d | "Window|Int.h"..|
|000002f0| 23 69 6e 63 6c 75 64 65 | 20 22 45 76 65 6e 74 55 |#include| "EventU|
|00000300| 74 69 6c 2e 68 22 0d 0d | 0d 2f 2a 2a 2a 20 20 4c |til.h"..|./*** L|
|00000310| 4f 43 41 4c 20 56 41 52 | 49 41 42 4c 45 53 20 20 |OCAL VAR|IABLES |
|00000320| 2a 2a 2a 2f 0d 0d 23 69 | 66 20 30 0d 09 23 69 66 |***/..#i|f 0..#if|
|00000330| 20 6b 43 6f 6d 70 69 6c | 65 57 69 74 68 54 68 72 | kCompil|eWithThr|
|00000340| 65 61 64 65 64 41 70 70 | 6c 65 45 76 65 6e 74 73 |eadedApp|leEvents|
|00000350| 0d 09 73 74 61 74 69 63 | 09 45 76 65 6e 74 52 65 |..static|.EventRe|
|00000360| 63 6f 72 64 20 2a 09 76 | 41 70 70 6c 65 45 76 65 |cord *.v|AppleEve|
|00000370| 6e 74 3b 0d 09 73 74 61 | 74 69 63 09 54 68 72 65 |nt;..sta|tic.Thre|
|00000380| 61 64 49 44 09 09 61 65 | 44 69 73 70 61 74 63 68 |adID..ae|Dispatch|
|00000390| 65 72 54 68 72 65 61 64 | 3b 0d 09 73 74 61 74 69 |erThread|;..stati|
|000003a0| 63 09 42 6f 6f 6c 65 61 | 6e 09 09 09 61 65 44 69 |c.Boolea|n...aeDi|
|000003b0| 73 70 61 74 63 68 69 6e | 67 3b 0d 09 23 65 6e 64 |spatchin|g;..#end|
|000003c0| 69 66 0d 23 65 6e 64 69 | 66 0d 0d 0d 2f 2a 2a 2a |if.#endi|f.../***|
|000003d0| 20 20 4c 4f 43 41 4c 20 | 50 52 4f 54 4f 54 59 50 | LOCAL |PROTOTYP|
|000003e0| 45 53 20 2a 2a 2a 2f 0d | 0d 2f 2f 70 61 73 63 61 |ES ***/.|.//pasca|
|000003f0| 6c 20 76 6f 69 64 20 2a | 09 61 70 70 6c 65 45 76 |l void *|.appleEv|
|00000400| 65 6e 74 44 69 73 70 61 | 74 63 68 54 68 72 65 61 |entDispa|tchThrea|
|00000410| 64 09 28 20 76 6f 69 64 | 20 2a 20 29 3b 0d 73 74 |d.( void| * );.st|
|00000420| 61 74 69 63 20 09 76 6f | 69 64 09 64 6f 4b 65 79 |atic .vo|id.doKey|
|00000430| 50 72 65 73 73 09 28 20 | 45 76 65 6e 74 52 65 63 |Press.( |EventRec|
|00000440| 6f 72 64 20 2a 20 29 3b | 0d 0d 0d 2f 2a 2a 2a 20 |ord * );|.../*** |
|00000450| 20 46 55 4e 43 54 49 4f | 4e 53 20 20 2a 2a 2a 2f | FUNCTIO|NS ***/|
|00000460| 0d 0d 2f 2a 20 0d 09 2d | 3e 6d 65 73 73 61 67 65 |../* ..-|>message|
|00000470| 09 6c 6f 6e 67 09 74 68 | 65 20 68 69 67 68 2d 6c |.long.th|e high-l|
|00000480| 65 76 65 6c 20 65 76 65 | 6e 74 20 63 6c 61 73 73 |evel eve|nt class|
|00000490| 20 74 6f 20 77 68 69 63 | 68 20 74 68 65 20 65 76 | to whic|h the ev|
|000004a0| 65 6e 74 20 62 65 6c 6f | 6e 67 73 0d 09 2d 3e 77 |ent belo|ngs..->w|
|000004b0| 68 65 6e 09 09 6c 6f 6e | 67 09 74 69 6d 65 20 77 |hen..lon|g.time w|
|000004c0| 68 65 6e 20 65 76 65 6e | 74 20 77 61 73 20 70 6f |hen even|t was po|
|000004d0| 73 74 65 64 20 28 69 6e | 20 74 69 63 6b 73 20 73 |sted (in| ticks s|
|000004e0| 69 6e 63 65 20 73 79 73 | 74 65 6d 20 73 74 61 72 |ince sys|tem star|
|000004f0| 74 75 70 29 0d 09 2d 3e | 77 68 65 72 65 09 09 50 |tup)..->|where..P|
|00000500| 6f 69 6e 74 09 74 68 65 | 20 68 69 67 68 2d 6c 65 |oint.the| high-le|
|00000510| 76 65 6c 20 65 76 65 6e | 74 20 49 44 20 28 63 61 |vel even|t ID (ca|
|00000520| 73 74 20 61 73 20 4f 53 | 54 79 70 65 29 0d 09 2d |st as OS|Type)..-|
|00000530| 3e 6d 6f 64 69 66 69 65 | 72 73 09 69 6e 74 09 09 |>modifie|rs.int..|
|00000540| 73 74 61 74 65 20 6f 66 | 20 6d 6f 64 69 66 69 65 |state of| modifie|
|00000550| 72 20 6b 65 79 73 20 61 | 6e 64 20 6d 6f 75 73 65 |r keys a|nd mouse|
|00000560| 20 62 75 74 74 6f 6e 20 | 61 74 20 65 76 65 6e 74 | button |at event|
|00000570| 20 74 69 6d 65 20 2a 2f | 0d 76 6f 69 64 0d 64 6f | time */|.void.do|
|00000580| 48 69 67 68 4c 65 76 65 | 6c 45 76 65 6e 74 20 28 |HighLeve|lEvent (|
|00000590| 20 45 76 65 6e 74 52 65 | 63 6f 72 64 20 2a 74 68 | EventRe|cord *th|
|000005a0| 65 45 76 65 6e 74 20 29 | 0d 7b 0d 09 4f 53 45 72 |eEvent )|.{..OSEr|
|000005b0| 72 09 09 74 68 65 45 72 | 72 3b 0d 09 0d 2f 2f 09 |r..theEr|r;...//.|
|000005c0| 73 77 69 74 63 68 20 28 | 20 74 68 65 45 76 65 6e |switch (| theEven|
|000005d0| 74 2d 3e 6d 65 73 73 61 | 67 65 20 29 0d 2f 2f 09 |t->messa|ge ).//.|
|000005e0| 7b 0d 09 09 2f 2a 20 79 | 6f 75 20 6d 61 79 20 69 |{.../* y|ou may i|
|000005f0| 6e 73 65 72 74 20 63 68 | 65 63 6b 73 20 66 6f 72 |nsert ch|ecks for|
|00000600| 20 68 69 67 68 20 6c 65 | 76 65 6c 20 65 76 65 6e | high le|vel even|
|00000610| 74 73 20 6f 74 68 65 72 | 20 74 68 61 6e 20 61 70 |ts other| than ap|
|00000620| 70 6c 65 20 65 76 65 6e | 74 73 20 2a 2f 0d 09 09 |ple even|ts */...|
|00000630| 0d 09 09 2f 2a 20 64 65 | 66 61 75 6c 74 20 74 79 |.../* de|fault ty|
|00000640| 70 65 20 69 73 20 61 70 | 70 6c 65 20 65 76 65 6e |pe is ap|ple even|
|00000650| 74 20 2a 2f 0d 2f 2f 09 | 09 64 65 66 61 75 6c 74 |t */.//.|.default|
|00000660| 20 3a 0d 2f 2f 09 09 09 | 23 69 66 20 6b 43 6f 6d | :.//...|#if kCom|
|00000670| 70 69 6c 65 57 69 74 68 | 54 68 72 65 61 64 65 64 |pileWith|Threaded|
|00000680| 41 70 70 6c 65 45 76 65 | 6e 74 73 0d 2f 2f 09 09 |AppleEve|nts.//..|
|00000690| 09 69 66 20 28 20 67 48 | 61 73 54 68 72 65 61 64 |.if ( gH|asThread|
|000006a0| 4d 67 72 20 26 26 20 28 | 61 65 44 69 73 70 61 74 |Mgr && (|aeDispat|
|000006b0| 63 68 65 72 54 68 72 65 | 61 64 20 21 3d 20 6e 69 |cherThre|ad != ni|
|000006c0| 6c 29 20 29 0d 2f 2f 09 | 09 09 7b 0d 2f 2f 09 09 |l) ).//.|..{.//..|
|000006d0| 09 09 74 68 65 45 72 72 | 20 3d 20 53 65 74 54 68 |..theErr| = SetTh|
|000006e0| 72 65 61 64 53 74 61 74 | 65 20 28 20 61 65 44 69 |readStat|e ( aeDi|
|000006f0| 73 70 61 74 63 68 65 72 | 54 68 72 65 61 64 2c 20 |spatcher|Thread, |
|00000700| 6b 52 65 61 64 79 54 68 | 72 65 61 64 53 74 61 74 |kReadyTh|readStat|
|00000710| 65 2c 20 6e 69 6c 20 29 | 3b 0d 2f 2f 09 09 09 7d |e, nil )|;.//...}|
|00000720| 0d 2f 2f 09 09 09 65 6c | 73 65 0d 2f 2f 09 09 09 |.//...el|se.//...|
|00000730| 7b 0d 2f 2f 09 09 09 23 | 65 6e 64 69 66 0d 09 09 |{.//...#|endif...|
|00000740| 09 0d 09 09 09 09 2f 2a | 20 a5 a5 a5 20 72 65 73 |....../*| ... res|
|00000750| 65 74 20 27 71 75 69 74 | 20 6f 6e 20 69 64 6c 65 |et 'quit| on idle|
|00000760| 20 74 69 6d 65 27 20 74 | 69 6d 65 72 20 2a 2f 0d | time' t|imer */.|
|00000770| 09 09 09 09 52 65 73 65 | 74 51 75 69 74 49 64 6c |....Rese|tQuitIdl|
|00000780| 65 54 69 6d 65 72 28 29 | 3b 0d 09 09 09 09 0d 09 |eTimer()|;.......|
|00000790| 09 09 09 74 68 65 45 72 | 72 20 3d 20 41 45 50 72 |...theEr|r = AEPr|
|000007a0| 6f 63 65 73 73 41 70 70 | 6c 65 45 76 65 6e 74 20 |ocessApp|leEvent |
|000007b0| 28 20 74 68 65 45 76 65 | 6e 74 20 29 3b 0d 09 09 |( theEve|nt );...|
|000007c0| 09 09 69 66 20 28 20 74 | 68 65 45 72 72 20 21 3d |..if ( t|heErr !=|
|000007d0| 20 6e 6f 45 72 72 20 29 | 0d 09 09 09 09 7b 0d 09 | noErr )|.....{..|
|000007e0| 09 09 09 09 2f 2a 20 79 | 6f 75 20 6d 69 67 68 74 |..../* y|ou might|
|000007f0| 20 77 61 6e 74 20 74 6f | 20 61 64 64 20 65 72 72 | want to| add err|
|00000800| 6f 72 20 68 61 6e 64 6c | 69 6e 67 20 68 65 72 65 |or handl|ing here|
|00000810| 2e 0d 09 09 09 09 09 09 | 48 6f 77 65 76 65 72 2c |........|However,|
|00000820| 20 49 20 61 64 76 69 73 | 65 20 61 67 61 69 6e 73 | I advis|e agains|
|00000830| 74 20 70 75 74 74 69 6e | 67 20 75 73 65 72 20 69 |t puttin|g user i|
|00000840| 6e 74 65 72 61 63 74 69 | 6f 6e 20 68 61 6e 64 6c |nteracti|on handl|
|00000850| 69 6e 67 20 68 65 72 65 | 2c 0d 09 09 09 09 09 09 |ing here|,.......|
|00000860| 69 74 20 63 61 6e 20 63 | 6f 6e 66 75 73 65 20 74 |it can c|onfuse t|
|00000870| 68 65 20 75 73 65 72 2e | 20 59 6f 75 20 6d 69 67 |he user.| You mig|
|00000880| 68 74 20 74 72 79 20 75 | 73 69 6e 67 20 61 6e 20 |ht try u|sing an |
|00000890| 61 73 73 65 72 74 69 6f | 6e 2e 20 2a 2f 0d 09 09 |assertio|n. */...|
|000008a0| 09 09 7d 0d 09 09 09 0d | 2f 2f 09 09 09 23 69 66 |..}.....|//...#if|
|000008b0| 20 6b 43 6f 6d 70 69 6c | 65 57 69 74 68 54 68 72 | kCompil|eWithThr|
|000008c0| 65 61 64 65 64 41 70 70 | 6c 65 45 76 65 6e 74 73 |eadedApp|leEvents|
|000008d0| 0d 2f 2f 09 09 09 7d 0d | 2f 2f 09 09 09 23 65 6e |.//...}.|//...#en|
|000008e0| 64 69 66 0d 2f 2f 09 09 | 09 62 72 65 61 6b 3b 0d |dif.//..|.break;.|
|000008f0| 2f 2f 09 7d 0d 7d 20 2f | 2a 20 64 6f 48 69 67 68 |//.}.} /|* doHigh|
|00000900| 4c 65 76 65 6c 45 76 65 | 6e 74 20 2a 2f 0d 0d 23 |LevelEve|nt */..#|
|00000910| 69 66 20 30 0d 09 2f 2a | 20 a5 a5 a5 20 49 47 4e |if 0../*| ... IGN|
|00000920| 4f 52 45 20 54 48 49 53 | 20 49 4e 43 4f 4d 50 4c |ORE THIS| INCOMPL|
|00000930| 45 54 45 20 43 48 55 4e | 4b 20 4f 46 20 43 4f 44 |ETE CHUN|K OF COD|
|00000940| 45 20 2a 2f 0d 09 2f 2a | 20 54 68 72 65 61 64 20 |E */../*| Thread |
|00000950| 66 6f 72 20 70 72 6f 63 | 65 73 73 69 6e 67 2f 64 |for proc|essing/d|
|00000960| 69 73 70 61 74 63 68 69 | 6e 67 20 69 6e 63 6f 6d |ispatchi|ng incom|
|00000970| 69 6e 67 20 41 70 70 6c | 65 45 76 65 6e 74 73 2e |ing Appl|eEvents.|
|00000980| 0d 09 09 49 6d 70 6c 65 | 6d 65 6e 74 65 64 20 74 |...Imple|mented t|
|00000990| 68 69 73 20 77 61 79 20 | 73 6f 20 74 68 61 74 20 |his way |so that |
|000009a0| 74 68 65 20 4d 61 69 6e | 45 76 65 6e 74 4c 6f 6f |the Main|EventLoo|
|000009b0| 70 20 63 61 6e 20 63 6f | 6e 74 69 6e 75 65 20 74 |p can co|ntinue t|
|000009c0| 6f 20 70 72 6f 63 65 73 | 73 20 69 66 0d 09 09 61 |o proces|s if...a|
|000009d0| 6c 6c 20 74 68 65 20 70 | 72 65 61 6c 6c 6f 63 61 |ll the p|realloca|
|000009e0| 74 65 64 20 74 68 72 65 | 61 64 73 20 67 65 74 20 |ted thre|ads get |
|000009f0| 75 73 65 64 20 75 70 2e | 20 54 68 69 73 20 74 68 |used up.| This th|
|00000a00| 72 65 61 64 20 67 6f 65 | 73 20 74 6f 20 73 6c 65 |read goe|s to sle|
|00000a10| 65 70 20 69 66 0d 09 09 | 74 68 65 72 65 20 61 72 |ep if...|there ar|
|00000a20| 65 20 6e 6f 20 61 76 61 | 69 6c 61 62 6c 65 20 70 |e no ava|ilable p|
|00000a30| 72 65 61 6c 6c 6f 63 61 | 74 65 64 20 74 68 72 65 |realloca|ted thre|
|00000a40| 61 64 73 2c 20 61 6e 64 | 20 69 73 20 77 6f 6b 65 |ads, and| is woke|
|00000a50| 6e 20 75 70 20 77 68 65 | 6e 20 6f 6e 65 0d 09 09 |n up whe|n one...|
|00000a60| 62 65 63 6f 6d 65 73 20 | 61 76 61 69 6c 61 62 6c |becomes |availabl|
|00000a70| 65 2e 20 2a 2f 0d 09 23 | 69 66 20 6b 43 6f 6d 70 |e. */..#|if kComp|
|00000a80| 69 6c 65 57 69 74 68 54 | 68 72 65 61 64 65 64 41 |ileWithT|hreadedA|
|00000a90| 70 70 6c 65 45 76 65 6e | 74 73 0d 09 70 61 73 63 |ppleEven|ts..pasc|
|00000aa0| 61 6c 20 76 6f 69 64 20 | 2a 0d 09 61 70 70 6c 65 |al void |*..apple|
|00000ab0| 45 76 65 6e 74 44 69 73 | 70 61 74 63 68 54 68 72 |EventDis|patchThr|
|00000ac0| 65 61 64 20 28 20 76 6f | 69 64 20 2a 74 68 65 50 |ead ( vo|id *theP|
|00000ad0| 61 72 61 6d 20 29 0d 09 | 7b 0d 09 09 4f 53 45 72 |aram )..|{...OSEr|
|00000ae0| 72 09 09 74 68 65 45 72 | 72 3b 0d 09 09 54 68 72 |r..theEr|r;...Thr|
|00000af0| 65 61 64 49 44 09 63 75 | 72 72 65 6e 74 54 68 72 |eadID.cu|rrentThr|
|00000b00| 65 61 64 3b 0d 09 09 0d | 09 09 47 65 74 43 75 72 |ead;....|..GetCur|
|00000b10| 72 65 6e 74 54 68 72 65 | 61 64 20 28 20 26 63 75 |rentThre|ad ( &cu|
|00000b20| 72 72 65 6e 74 54 68 72 | 65 61 64 20 29 3b 0d 09 |rrentThr|ead );..|
|00000b30| 09 0d 09 09 77 68 69 6c | 65 20 28 20 61 65 44 69 |....whil|e ( aeDi|
|00000b40| 73 70 61 74 63 68 69 6e | 67 20 29 0d 09 09 7b 0d |spatchin|g )...{.|
|00000b50| 09 09 09 69 66 20 28 20 | 76 41 70 70 6c 65 45 76 |...if ( |vAppleEv|
|00000b60| 65 6e 74 20 21 3d 20 6e | 69 6c 20 29 0d 09 09 09 |ent != n|il )....|
|00000b70| 7b 0d 09 09 09 09 74 68 | 65 45 72 72 20 3d 20 41 |{.....th|eErr = A|
|00000b80| 45 50 72 6f 63 65 73 73 | 41 70 70 6c 65 45 76 65 |EProcess|AppleEve|
|00000b90| 6e 74 20 28 20 76 41 70 | 70 6c 65 45 76 65 6e 74 |nt ( vAp|pleEvent|
|00000ba0| 20 29 3b 0d 09 09 09 09 | 69 66 20 28 20 74 68 65 | );.....|if ( the|
|00000bb0| 45 72 72 20 21 3d 20 6e | 6f 45 72 72 20 29 0d 09 |Err != n|oErr )..|
|00000bc0| 09 09 09 7b 0d 09 09 09 | 09 09 2f 2a 20 79 6f 75 |...{....|../* you|
|00000bd0| 20 6d 69 67 68 74 20 77 | 61 6e 74 20 74 6f 20 61 | might w|ant to a|
|00000be0| 64 64 20 65 72 72 6f 72 | 20 68 61 6e 64 6c 69 6e |dd error| handlin|
|00000bf0| 67 20 68 65 72 65 2e 0d | 09 09 09 09 09 09 48 6f |g here..|......Ho|
|00000c00| 77 65 76 65 72 2c 20 49 | 20 61 64 76 69 73 65 20 |wever, I| advise |
|00000c10| 61 67 61 69 6e 73 74 20 | 70 75 74 74 69 6e 67 20 |against |putting |
|00000c20| 75 73 65 72 20 69 6e 74 | 65 72 61 63 74 69 6f 6e |user int|eraction|
|00000c30| 20 68 61 6e 64 6c 69 6e | 67 20 68 65 72 65 2c 0d | handlin|g here,.|
|00000c40| 09 09 09 09 09 09 69 74 | 20 63 61 6e 20 63 6f 6e |......it| can con|
|00000c50| 66 75 73 65 20 74 68 65 | 20 75 73 65 72 2e 20 59 |fuse the| user. Y|
|00000c60| 6f 75 20 6d 69 67 68 74 | 20 74 72 79 20 75 73 69 |ou might| try usi|
|00000c70| 6e 67 20 61 6e 20 61 73 | 73 65 72 74 69 6f 6e 2e |ng an as|sertion.|
|00000c80| 20 2a 2f 0d 09 09 09 09 | 7d 0d 09 09 09 7d 0d 09 | */.....|}....}..|
|00000c90| 09 09 0d 09 09 09 2f 2a | 20 70 75 74 20 74 68 69 |....../*| put thi|
|00000ca0| 73 20 74 68 72 65 61 64 | 20 62 61 63 6b 20 74 6f |s thread| back to|
|00000cb0| 20 73 6c 65 65 70 20 2a | 2f 0d 09 09 09 76 41 70 | sleep *|/....vAp|
|00000cc0| 70 6c 65 45 76 65 6e 74 | 20 3d 20 6e 69 6c 3b 0d |pleEvent| = nil;.|
|00000cd0| 09 09 09 74 68 65 45 72 | 72 20 3d 20 53 65 74 54 |...theEr|r = SetT|
|00000ce0| 68 72 65 61 64 53 74 61 | 74 65 20 28 20 63 75 72 |hreadSta|te ( cur|
|00000cf0| 72 65 6e 74 54 68 72 65 | 61 64 2c 20 6b 53 74 6f |rentThre|ad, kSto|
|00000d00| 70 70 65 64 54 68 72 65 | 61 64 53 74 61 74 65 2c |ppedThre|adState,|
|00000d10| 20 6e 69 6c 20 29 3b 0d | 09 09 7d 0d 09 7d 20 2f | nil );.|..}..} /|
|00000d20| 2a 20 61 70 70 6c 65 45 | 76 65 6e 74 44 69 73 70 |* appleE|ventDisp|
|00000d30| 61 74 63 68 54 68 72 65 | 61 64 20 2a 2f 0d 09 23 |atchThre|ad */..#|
|00000d40| 65 6e 64 69 66 0d 09 0d | 09 2f 2a 20 53 68 6f 75 |endif...|./* Shou|
|00000d50| 6c 64 20 62 65 20 63 61 | 6c 6c 65 64 20 6f 6e 6c |ld be ca|lled onl|
|00000d60| 79 20 6f 6e 63 65 20 2a | 2f 0d 09 23 69 66 20 6b |y once *|/..#if k|
|00000d70| 43 6f 6d 70 69 6c 65 57 | 69 74 68 54 68 72 65 61 |CompileW|ithThrea|
|00000d80| 64 65 64 41 70 70 6c 65 | 45 76 65 6e 74 73 0d 09 |dedApple|Events..|
|00000d90| 4f 53 45 72 72 0d 09 45 | 76 65 6e 74 53 70 61 77 |OSErr..E|ventSpaw|
|00000da0| 6e 41 45 44 69 73 70 61 | 74 63 68 65 72 54 68 72 |nAEDispa|tcherThr|
|00000db0| 65 61 64 20 28 20 76 6f | 69 64 20 29 0d 09 7b 0d |ead ( vo|id )..{.|
|00000dc0| 09 09 4f 53 45 72 72 09 | 74 68 65 45 72 72 3b 0d |..OSErr.|theErr;.|
|00000dd0| 09 09 0d 09 09 76 41 70 | 70 6c 65 45 76 65 6e 74 |.....vAp|pleEvent|
|00000de0| 20 20 20 3d 20 6e 69 6c | 3b 0d 09 09 61 65 44 69 | = nil|;...aeDi|
|00000df0| 73 70 61 74 63 68 69 6e | 67 20 3d 20 74 72 75 65 |spatchin|g = true|
|00000e00| 3b 0d 09 09 0d 09 09 74 | 68 65 45 72 72 20 3d 20 |;......t|heErr = |
|00000e10| 4e 65 77 54 68 72 65 61 | 64 20 28 20 6b 43 6f 6f |NewThrea|d ( kCoo|
|00000e20| 70 65 72 61 74 69 76 65 | 54 68 72 65 61 64 2c 20 |perative|Thread, |
|00000e30| 61 70 70 6c 65 45 76 65 | 6e 74 44 69 73 70 61 74 |appleEve|ntDispat|
|00000e40| 63 68 54 68 72 65 61 64 | 2c 20 6e 69 6c 2c 20 6e |chThread|, nil, n|
|00000e50| 69 6c 2c 0d 09 09 09 6b | 4e 65 77 53 75 73 70 65 |il,....k|NewSuspe|
|00000e60| 6e 64 20 2b 20 6b 46 50 | 55 4e 6f 74 4e 65 65 64 |nd + kFP|UNotNeed|
|00000e70| 65 64 2c 20 6e 69 6c 2c | 20 26 61 65 44 69 73 70 |ed, nil,| &aeDisp|
|00000e80| 61 74 63 68 65 72 54 68 | 72 65 61 64 20 29 3b 0d |atcherTh|read );.|
|00000e90| 09 09 0d 09 09 72 65 74 | 75 72 6e 20 74 68 65 45 |.....ret|urn theE|
|00000ea0| 72 72 3b 0d 09 7d 20 2f | 2a 20 45 76 65 6e 74 53 |rr;..} /|* EventS|
|00000eb0| 70 61 77 6e 41 45 44 69 | 73 70 61 74 63 68 65 72 |pawnAEDi|spatcher|
|00000ec0| 54 68 72 65 61 64 20 2a | 2f 0d 09 23 65 6e 64 69 |Thread *|/..#endi|
|00000ed0| 66 0d 09 0d 09 2f 2a 20 | 53 68 6f 75 6c 64 20 62 |f..../* |Should b|
|00000ee0| 65 20 63 61 6c 6c 65 64 | 20 6f 6e 6c 79 20 6f 6e |e called| only on|
|00000ef0| 63 65 20 2a 2f 0d 09 23 | 69 66 20 6b 43 6f 6d 70 |ce */..#|if kComp|
|00000f00| 69 6c 65 57 69 74 68 54 | 68 72 65 61 64 65 64 41 |ileWithT|hreadedA|
|00000f10| 70 70 6c 65 45 76 65 6e | 74 73 0d 09 4f 53 45 72 |ppleEven|ts..OSEr|
|00000f20| 72 0d 09 45 76 65 6e 74 | 44 69 73 70 6f 73 65 41 |r..Event|DisposeA|
|00000f30| 45 44 69 73 70 61 74 63 | 68 65 72 54 68 72 65 61 |EDispatc|herThrea|
|00000f40| 64 20 28 20 76 6f 69 64 | 20 29 0d 09 7b 0d 09 09 |d ( void| )..{...|
|00000f50| 4f 53 45 72 72 09 74 68 | 65 45 72 72 3b 0d 09 09 |OSErr.th|eErr;...|
|00000f60| 0d 09 09 6d 79 5f 61 73 | 73 65 72 74 20 28 20 61 |...my_as|sert ( a|
|00000f70| 65 44 69 73 70 61 74 63 | 68 65 72 54 68 72 65 61 |eDispatc|herThrea|
|00000f80| 64 20 21 3d 20 6e 69 6c | 2c 20 22 5c 70 45 76 65 |d != nil|, "\pEve|
|00000f90| 6e 74 44 69 73 70 6f 73 | 65 41 45 44 69 73 70 61 |ntDispos|eAEDispa|
|00000fa0| 74 63 68 65 72 54 68 72 | 65 61 64 3a 20 61 65 44 |tcherThr|ead: aeD|
|00000fb0| 69 73 70 61 74 63 68 65 | 72 54 68 72 65 61 64 20 |ispatche|rThread |
|00000fc0| 69 73 20 6e 69 6c 22 20 | 29 3b 0d 09 09 6d 79 5f |is nil" |);...my_|
|00000fd0| 61 73 73 65 72 74 20 28 | 20 67 44 6f 6e 65 20 21 |assert (| gDone !|
|00000fe0| 3d 20 66 61 6c 73 65 2c | 20 22 5c 70 45 76 65 6e |= false,| "\pEven|
|00000ff0| 74 44 69 73 70 6f 73 65 | 41 45 44 69 73 70 61 74 |tDispose|AEDispat|
|00001000| 63 68 65 72 54 68 72 65 | 61 64 3a 20 67 44 6f 6e |cherThre|ad: gDon|
|00001010| 65 20 69 73 20 66 61 6c | 73 65 22 20 29 3b 0d 09 |e is fal|se" );..|
|00001020| 09 0d 09 09 77 68 69 6c | 65 20 28 20 76 41 70 70 |....whil|e ( vApp|
|00001030| 6c 65 45 76 65 6e 74 20 | 21 3d 20 6e 69 6c 20 29 |leEvent |!= nil )|
|00001040| 0d 09 09 7b 0d 09 09 09 | 59 69 65 6c 64 54 6f 54 |...{....|YieldToT|
|00001050| 68 72 65 61 64 20 28 20 | 61 65 44 69 73 70 61 74 |hread ( |aeDispat|
|00001060| 63 68 65 72 54 68 72 65 | 61 64 20 29 3b 0d 09 09 |cherThre|ad );...|
|00001070| 7d 0d 09 09 0d 09 09 61 | 65 44 69 73 70 61 74 63 |}......a|eDispatc|
|00001080| 68 69 6e 67 20 3d 20 66 | 61 6c 73 65 3b 0d 09 09 |hing = f|alse;...|
|00001090| 0d 09 09 59 69 65 6c 64 | 54 6f 54 68 72 65 61 64 |...Yield|ToThread|
|000010a0| 20 28 20 61 65 44 69 73 | 70 61 74 63 68 65 72 54 | ( aeDis|patcherT|
|000010b0| 68 72 65 61 64 20 29 3b | 0d 09 09 0d 09 09 72 65 |hread );|......re|
|000010c0| 74 75 72 6e 20 74 68 65 | 45 72 72 3b 0d 09 7d 20 |turn the|Err;..} |
|000010d0| 2f 2a 20 45 76 65 6e 74 | 53 70 61 77 6e 41 45 44 |/* Event|SpawnAED|
|000010e0| 69 73 70 61 74 63 68 65 | 72 54 68 72 65 61 64 20 |ispatche|rThread |
|000010f0| 2a 2f 0d 09 23 65 6e 64 | 69 66 0d 23 65 6e 64 69 |*/..#end|if.#endi|
|00001100| 66 0d 0d 0d 2f 2a 2a 20 | 20 55 53 45 52 20 49 4e |f.../** | USER IN|
|00001110| 54 45 52 46 41 43 45 20 | 20 2a 2a 2f 0d 23 70 72 |TERFACE | **/.#pr|
|00001120| 61 67 6d 61 20 6d 61 72 | 6b 20 2d 0d 23 69 66 20 |agma mar|k -.#if |
|00001130| 6b 43 6f 6d 70 69 6c 65 | 57 69 74 68 46 6f 72 65 |kCompile|WithFore|
|00001140| 67 72 6f 75 6e 64 0d 0d | 2f 2a 20 0d 09 2d 3e 6d |ground..|/* ..->m|
|00001150| 65 73 73 61 67 65 09 6c | 6f 6e 67 09 75 6e 64 65 |essage.l|ong.unde|
|00001160| 66 69 6e 65 64 0d 09 2d | 3e 77 68 65 6e 09 09 6c |fined..-|>when..l|
|00001170| 6f 6e 67 09 74 69 6d 65 | 20 77 68 65 6e 20 65 76 |ong.time| when ev|
|00001180| 65 6e 74 20 77 61 73 20 | 70 6f 73 74 65 64 20 28 |ent was |posted (|
|00001190| 69 6e 20 74 69 63 6b 73 | 20 73 69 6e 63 65 20 73 |in ticks| since s|
|000011a0| 79 73 74 65 6d 20 73 74 | 61 72 74 75 70 29 0d 09 |ystem st|artup)..|
|000011b0| 2d 3e 77 68 65 72 65 09 | 09 50 6f 69 6e 74 09 63 |->where.|.Point.c|
|000011c0| 75 72 73 6f 72 20 6c 6f | 63 61 74 69 6f 6e 20 61 |ursor lo|cation a|
|000011d0| 74 20 65 76 65 6e 74 20 | 74 69 6d 65 0d 09 2d 3e |t event |time..->|
|000011e0| 6d 6f 64 69 66 69 65 72 | 73 09 69 6e 74 09 09 73 |modifier|s.int..s|
|000011f0| 74 61 74 65 20 6f 66 20 | 6d 6f 64 69 66 69 65 72 |tate of |modifier|
|00001200| 20 6b 65 79 73 20 61 6e | 64 20 6d 6f 75 73 65 20 | keys an|d mouse |
|00001210| 62 75 74 74 6f 6e 20 61 | 74 20 65 76 65 6e 74 20 |button a|t event |
|00001220| 74 69 6d 65 0d 09 09 09 | 09 09 09 61 6e 64 20 77 |time....|...and w|
|00001230| 65 74 68 65 72 20 74 68 | 65 20 6d 6f 75 73 65 2d |ether th|e mouse-|
|00001240| 64 6f 77 6e 20 63 61 75 | 73 65 64 20 74 68 65 20 |down cau|sed the |
|00001250| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 74 6f 20 63 |applicat|ion to c|
|00001260| 6f 6d 65 20 74 6f 20 74 | 68 65 20 66 6f 72 65 67 |ome to t|he foreg|
|00001270| 72 6f 75 6e 64 0d 09 49 | 4d 2d 4d 54 45 3a 20 32 |round..I|M-MTE: 2|
|00001280| 2d 33 34 20 2a 2f 0d 76 | 6f 69 64 0d 64 6f 4d 6f |-34 */.v|oid.doMo|
|00001290| 75 73 65 44 6f 77 6e 20 | 28 20 45 76 65 6e 74 52 |useDown |( EventR|
|000012a0| 65 63 6f 72 64 20 2a 74 | 68 65 45 76 65 6e 74 20 |ecord *t|heEvent |
|000012b0| 29 0d 7b 0d 09 57 69 6e | 64 6f 77 50 74 72 20 09 |).{..Win|dowPtr .|
|000012c0| 74 68 65 57 69 6e 64 6f | 77 3b 0d 09 73 68 6f 72 |theWindo|w;..shor|
|000012d0| 74 20 20 09 09 77 68 65 | 72 65 3b 0d 09 42 6f 6f |t ..whe|re;..Boo|
|000012e0| 6c 65 61 6e 09 09 6f 6e | 49 74 65 6d 3b 0d 09 23 |lean..on|Item;..#|
|000012f0| 69 66 20 6b 43 6f 6d 70 | 69 6c 65 57 69 74 68 44 |if kComp|ileWithD|
|00001300| 72 61 67 4e 44 72 6f 70 | 0d 09 4f 53 45 72 72 09 |ragNDrop|..OSErr.|
|00001310| 09 74 68 65 45 72 72 3b | 0d 09 23 65 6e 64 69 66 |.theErr;|..#endif|
|00001320| 0d 09 0d 09 23 69 66 20 | 6b 43 6f 6d 70 69 6c 65 |....#if |kCompile|
|00001330| 57 69 74 68 4d 6f 64 65 | 6c 65 73 73 44 69 61 6c |WithMode|lessDial|
|00001340| 6f 67 73 0d 09 2f 2a 20 | 6d 6f 64 65 6c 65 73 73 |ogs../* |modeless|
|00001350| 20 64 69 61 6c 6f 67 73 | 20 2a 2f 0d 09 42 6f 6f | dialogs| */..Boo|
|00001360| 6c 65 61 6e 09 09 64 69 | 61 6c 6f 67 45 76 65 6e |lean..di|alogEven|
|00001370| 74 3b 0d 09 42 6f 6f 6c | 65 61 6e 09 09 64 69 61 |t;..Bool|ean..dia|
|00001380| 6c 6f 67 52 65 73 75 6c | 74 3b 0d 09 44 69 61 6c |logResul|t;..Dial|
|00001390| 6f 67 50 74 72 09 74 68 | 65 44 69 61 6c 6f 67 3b |ogPtr.th|eDialog;|
|000013a0| 0d 09 73 68 6f 72 74 09 | 09 69 74 65 6d 48 69 74 |..short.|.itemHit|
|000013b0| 3b 0d 09 0d 09 2f 2a 20 | 64 65 74 65 72 6d 69 6e |;..../* |determin|
|000013c0| 65 20 77 68 65 74 68 65 | 72 20 74 68 65 20 65 76 |e whethe|r the ev|
|000013d0| 65 6e 74 20 69 73 20 66 | 6f 72 20 61 20 6d 6f 64 |ent is f|or a mod|
|000013e0| 65 6c 65 73 73 20 64 69 | 61 6c 6f 67 20 2a 2f 0d |eless di|alog */.|
|000013f0| 09 64 69 61 6c 6f 67 45 | 76 65 6e 74 20 3d 20 49 |.dialogE|vent = I|
|00001400| 73 44 69 61 6c 6f 67 45 | 76 65 6e 74 20 28 20 74 |sDialogE|vent ( t|
|00001410| 68 65 45 76 65 6e 74 20 | 29 3b 0d 0d 09 69 66 20 |heEvent |);...if |
|00001420| 28 20 64 69 61 6c 6f 67 | 45 76 65 6e 74 20 29 0d |( dialog|Event ).|
|00001430| 09 7b 0d 09 09 64 69 61 | 6c 6f 67 52 65 73 75 6c |.{...dia|logResul|
|00001440| 74 20 3d 20 44 69 61 6c | 6f 67 53 65 6c 65 63 74 |t = Dial|ogSelect|
|00001450| 20 28 20 74 68 65 45 76 | 65 6e 74 2c 20 26 74 68 | ( theEv|ent, &th|
|00001460| 65 44 69 61 6c 6f 67 2c | 20 26 69 74 65 6d 48 69 |eDialog,| &itemHi|
|00001470| 74 20 29 3b 0d 09 7d 0d | 09 65 6c 73 65 0d 09 7b |t );..}.|.else..{|
|00001480| 0d 09 23 65 6e 64 69 66 | 0d 09 0d 09 09 77 68 65 |..#endif|.....whe|
|00001490| 72 65 20 3d 20 46 69 6e | 64 57 69 6e 64 6f 77 20 |re = Fin|dWindow |
|000014a0| 28 20 74 68 65 45 76 65 | 6e 74 2d 3e 77 68 65 72 |( theEve|nt->wher|
|000014b0| 65 2c 20 26 74 68 65 57 | 69 6e 64 6f 77 20 29 3b |e, &theW|indow );|
|000014c0| 0d 09 09 0d 09 09 73 77 | 69 74 63 68 20 28 20 77 |......sw|itch ( w|
|000014d0| 68 65 72 65 20 29 20 2f | 2a 20 77 68 65 72 65 20 |here ) /|* where |
|000014e0| 74 68 65 20 65 76 65 6e | 74 20 6f 63 63 75 72 72 |the even|t occurr|
|000014f0| 65 64 20 2a 2f 0d 09 09 | 7b 0d 09 09 09 63 61 73 |ed */...|{....cas|
|00001500| 65 20 69 6e 44 65 73 6b | 20 3a 0d 09 09 09 09 62 |e inDesk| :.....b|
|00001510| 72 65 61 6b 3b 0d 09 09 | 09 0d 09 09 09 63 61 73 |reak;...|.....cas|
|00001520| 65 20 69 6e 4d 65 6e 75 | 42 61 72 20 3a 0d 09 09 |e inMenu|Bar :...|
|00001530| 09 09 61 64 6a 75 73 74 | 4d 65 6e 75 73 09 28 29 |..adjust|Menus.()|
|00001540| 3b 0d 09 09 09 09 64 6f | 4d 65 6e 75 09 09 28 20 |;.....do|Menu..( |
|00001550| 4d 65 6e 75 53 65 6c 65 | 63 74 28 74 68 65 45 76 |MenuSele|ct(theEv|
|00001560| 65 6e 74 2d 3e 77 68 65 | 72 65 29 2c 20 74 68 65 |ent->whe|re), the|
|00001570| 45 76 65 6e 74 2d 3e 6d | 6f 64 69 66 69 65 72 73 |Event->m|odifiers|
|00001580| 20 29 3b 0d 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 | );.....|break;..|
|00001590| 09 09 0d 09 09 09 63 61 | 73 65 20 69 6e 53 79 73 |......ca|se inSys|
|000015a0| 57 69 6e 64 6f 77 20 3a | 0d 09 09 09 09 2f 2a 20 |Window :|...../* |
|000015b0| 63 6c 69 63 6b 20 69 6e | 20 61 20 64 65 73 6b 20 |click in| a desk |
|000015c0| 61 63 63 65 73 73 6f 72 | 79 20 77 69 6e 64 6f 77 |accessor|y window|
|000015d0| 20 2a 2f 0d 09 09 09 09 | 53 79 73 74 65 6d 43 6c | */.....|SystemCl|
|000015e0| 69 63 6b 20 28 20 74 68 | 65 45 76 65 6e 74 2c 20 |ick ( th|eEvent, |
|000015f0| 74 68 65 57 69 6e 64 6f | 77 20 29 3b 0d 09 09 09 |theWindo|w );....|
|00001600| 09 62 72 65 61 6b 3b 0d | 09 09 0d 09 09 09 63 61 |.break;.|......ca|
|00001610| 73 65 20 69 6e 43 6f 6e | 74 65 6e 74 20 3a 0d 09 |se inCon|tent :..|
|00001620| 09 09 09 2f 2a 20 63 6f | 6e 74 65 6e 74 20 72 65 |.../* co|ntent re|
|00001630| 67 69 6f 6e 20 6f 66 20 | 61 20 77 69 6e 64 6f 77 |gion of |a window|
|00001640| 20 2a 2f 0d 09 09 09 09 | 69 66 20 28 20 28 74 68 | */.....|if ( (th|
|00001650| 65 57 69 6e 64 6f 77 20 | 21 3d 20 46 72 6f 6e 74 |eWindow |!= Front|
|00001660| 57 69 6e 64 6f 77 28 29 | 29 20 7c 7c 20 21 28 28 |Window()|) || !((|
|00001670| 28 57 69 6e 64 6f 77 50 | 65 65 6b 29 74 68 65 57 |(WindowP|eek)theW|
|00001680| 69 6e 64 6f 77 29 2d 3e | 68 69 6c 69 74 65 64 29 |indow)->|hilited)|
|00001690| 20 29 0d 09 09 09 09 7b | 0d 09 09 09 09 09 73 77 | ).....{|......sw|
|000016a0| 69 74 63 68 20 28 20 57 | 69 6e 64 6f 77 54 79 70 |itch ( W|indowTyp|
|000016b0| 65 28 46 72 6f 6e 74 57 | 69 6e 64 6f 77 28 29 29 |e(FrontW|indow())|
|000016c0| 20 29 0d 09 09 09 09 09 | 7b 0d 09 09 09 09 09 09 | )......|{.......|
|000016d0| 63 61 73 65 20 57 69 6e | 64 6f 77 5f 64 6c 67 4d |case Win|dow_dlgM|
|000016e0| 6f 64 61 6c 20 3a 0d 09 | 09 09 09 09 09 63 61 73 |odal :..|.....cas|
|000016f0| 65 20 57 69 6e 64 6f 77 | 5f 64 6c 67 4d 6f 76 65 |e Window|_dlgMove|
|00001700| 61 62 6c 65 4d 6f 64 61 | 6c 20 3a 0d 09 09 09 09 |ableModa|l :.....|
|00001710| 09 09 09 2f 2a 20 62 65 | 65 70 20 62 65 63 61 75 |.../* be|ep becau|
|00001720| 73 65 20 63 61 6e 27 74 | 20 73 77 69 74 63 68 20 |se can't| switch |
|00001730| 66 72 6f 6d 20 6d 6f 64 | 61 6c 20 64 69 61 6c 6f |from mod|al dialo|
|00001740| 67 20 2a 2f 0d 09 09 09 | 09 09 09 09 53 79 73 42 |g */....|....SysB|
|00001750| 65 65 70 20 28 20 33 30 | 20 29 3b 0d 09 09 09 09 |eep ( 30| );.....|
|00001760| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 09 09 |...break|;.......|
|00001770| 0d 09 09 09 09 09 09 63 | 61 73 65 20 57 69 6e 64 |.......c|ase Wind|
|00001780| 6f 77 5f 55 4e 4b 4e 4f | 57 4e 20 3a 0d 09 09 09 |ow_UNKNO|WN :....|
|00001790| 09 09 09 09 6d 79 5f 61 | 73 73 65 72 74 20 28 20 |....my_a|ssert ( |
|000017a0| 6b 46 6f 72 63 65 41 73 | 73 65 72 74 2c 20 22 5c |kForceAs|sert, "\|
|000017b0| 70 64 6f 4d 6f 75 73 65 | 44 6f 77 6e 3a 20 55 6e |pdoMouse|Down: Un|
|000017c0| 6b 6e 6f 77 6e 20 77 69 | 6e 64 6f 77 20 74 79 70 |known wi|ndow typ|
|000017d0| 65 22 20 29 3b 0d 09 09 | 09 09 09 09 0d 09 09 09 |e" );...|........|
|000017e0| 09 09 09 63 61 73 65 20 | 57 69 6e 64 6f 77 5f 61 |...case |Window_a|
|000017f0| 62 6f 75 74 20 3a 0d 09 | 09 09 09 09 09 63 61 73 |bout :..|.....cas|
|00001800| 65 20 57 69 6e 64 6f 77 | 5f 44 41 20 3a 0d 09 09 |e Window|_DA :...|
|00001810| 09 09 09 09 64 65 66 61 | 75 6c 74 20 3a 0d 09 09 |....defa|ult :...|
|00001820| 09 09 09 09 09 53 65 6c | 65 63 74 57 69 6e 64 6f |.....Sel|ectWindo|
|00001830| 77 20 28 20 74 68 65 57 | 69 6e 64 6f 77 20 29 3b |w ( theW|indow );|
|00001840| 0d 09 09 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |........|break;..|
|00001850| 09 09 09 09 7d 0d 09 09 | 09 09 7d 0d 09 09 09 09 |....}...|..}.....|
|00001860| 65 6c 73 65 0d 09 09 09 | 09 7b 0d 09 09 09 09 09 |else....|.{......|
|00001870| 6f 6e 49 74 65 6d 20 3d | 20 66 61 6c 73 65 3b 0d |onItem =| false;.|
|00001880| 09 09 09 09 09 57 69 6e | 64 6f 77 43 6f 6e 74 65 |.....Win|dowConte|
|00001890| 6e 74 43 6c 69 63 6b 20 | 28 20 74 68 65 57 69 6e |ntClick |( theWin|
|000018a0| 64 6f 77 2c 20 74 68 65 | 45 76 65 6e 74 2c 20 26 |dow, the|Event, &|
|000018b0| 6f 6e 49 74 65 6d 20 29 | 3b 0d 09 09 09 09 09 0d |onItem )|;.......|
|000018c0| 09 09 09 09 09 23 69 66 | 20 6b 43 6f 6d 70 69 6c |.....#if| kCompil|
|000018d0| 65 57 69 74 68 44 72 61 | 67 4e 44 72 6f 70 0d 09 |eWithDra|gNDrop..|
|000018e0| 09 09 09 09 69 66 20 28 | 20 67 48 61 73 44 72 61 |....if (| gHasDra|
|000018f0| 67 4e 44 72 6f 70 20 26 | 26 20 6f 6e 49 74 65 6d |gNDrop &|& onItem|
|00001900| 20 26 26 20 28 57 61 69 | 74 4d 6f 75 73 65 4d 6f | && (Wai|tMouseMo|
|00001910| 76 65 64 28 74 68 65 45 | 76 65 6e 74 2d 3e 77 68 |ved(theE|vent->wh|
|00001920| 65 72 65 29 29 20 29 0d | 09 09 09 09 09 7b 0d 09 |ere)) ).|.....{..|
|00001930| 09 09 09 09 09 74 68 65 | 45 72 72 20 3d 20 4d 79 |.....the|Err = My|
|00001940| 44 6f 53 74 61 72 74 44 | 72 61 67 20 28 20 74 68 |DoStartD|rag ( th|
|00001950| 65 45 76 65 6e 74 2c 20 | 74 68 65 57 69 6e 64 6f |eEvent, |theWindo|
|00001960| 77 20 29 3b 0d 09 09 09 | 09 09 7d 0d 09 09 09 09 |w );....|..}.....|
|00001970| 09 23 65 6e 64 69 66 0d | 09 09 09 09 7d 0d 09 09 |.#endif.|....}...|
|00001980| 09 09 62 72 65 61 6b 3b | 0d 09 0d 09 09 09 63 61 |..break;|......ca|
|00001990| 73 65 20 69 6e 44 72 61 | 67 20 3a 0d 09 09 09 09 |se inDra|g :.....|
|000019a0| 2f 2a 20 74 69 74 6c 65 | 20 62 61 72 20 72 65 67 |/* title| bar reg|
|000019b0| 69 6f 6e 20 6f 66 20 61 | 20 77 69 6e 64 6f 77 20 |ion of a| window |
|000019c0| 2a 2f 0d 09 09 09 09 73 | 77 69 74 63 68 20 28 20 |*/.....s|witch ( |
|000019d0| 57 69 6e 64 6f 77 54 79 | 70 65 28 74 68 65 57 69 |WindowTy|pe(theWi|
|000019e0| 6e 64 6f 77 29 20 29 0d | 09 09 09 09 7b 0d 09 09 |ndow) ).|....{...|
|000019f0| 09 09 09 63 61 73 65 20 | 57 69 6e 64 6f 77 5f 64 |...case |Window_d|
|00001a00| 6c 67 4d 6f 76 65 61 62 | 6c 65 4d 6f 64 61 6c 20 |lgMoveab|leModal |
|00001a10| 3a 0d 09 09 09 09 09 09 | 69 66 20 28 20 28 74 68 |:.......|if ( (th|
|00001a20| 65 57 69 6e 64 6f 77 20 | 3d 3d 20 46 72 6f 6e 74 |eWindow |== Front|
|00001a30| 57 69 6e 64 6f 77 28 29 | 29 20 7c 7c 20 28 74 68 |Window()|) || (th|
|00001a40| 65 45 76 65 6e 74 2d 3e | 6d 6f 64 69 66 69 65 72 |eEvent->|modifier|
|00001a50| 73 20 26 20 63 6d 64 4b | 65 79 29 20 29 0d 09 09 |s & cmdK|ey) )...|
|00001a60| 09 09 09 09 7b 0d 09 09 | 09 09 09 09 09 44 72 61 |....{...|.....Dra|
|00001a70| 67 57 69 6e 64 6f 77 20 | 28 20 74 68 65 57 69 6e |gWindow |( theWin|
|00001a80| 64 6f 77 2c 20 74 68 65 | 45 76 65 6e 74 2d 3e 77 |dow, the|Event->w|
|00001a90| 68 65 72 65 2c 20 26 67 | 47 72 61 79 52 67 6e 52 |here, &g|GrayRgnR|
|00001aa0| 65 63 74 20 29 3b 0d 09 | 09 09 09 09 09 7d 0d 09 |ect );..|.....}..|
|00001ab0| 09 09 09 09 09 65 6c 73 | 65 0d 09 09 09 09 09 09 |.....els|e.......|
|00001ac0| 7b 0d 09 09 09 09 09 09 | 09 2f 2a 20 62 65 65 70 |{.......|./* beep|
|00001ad0| 20 62 65 63 61 75 73 65 | 20 63 61 6e 27 74 20 73 | because| can't s|
|00001ae0| 77 69 74 63 68 20 66 72 | 6f 6d 20 6d 6f 76 65 61 |witch fr|om movea|
|00001af0| 62 6c 65 20 6d 6f 64 61 | 6c 20 64 69 61 6c 6f 67 |ble moda|l dialog|
|00001b00| 20 2a 2f 0d 09 09 09 09 | 09 09 09 53 79 73 42 65 | */.....|...SysBe|
|00001b10| 65 70 20 28 20 33 30 20 | 29 3b 0d 09 09 09 09 09 |ep ( 30 |);......|
|00001b20| 09 7d 0d 09 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |.}......|.break;.|
|00001b30| 09 09 09 09 09 0d 09 09 | 09 09 09 64 65 66 61 75 |........|...defau|
|00001b40| 6c 74 20 3a 0d 09 09 09 | 09 09 09 2f 2a 20 69 66 |lt :....|.../* if|
|00001b50| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 20 6b 65 79 | the com|mand key|
|00001b60| 20 69 73 20 70 72 65 73 | 73 65 64 2c 20 64 6f 6e | is pres|sed, don|
|00001b70| 27 74 20 61 63 74 69 76 | 61 74 65 20 74 68 65 20 |'t activ|ate the |
|00001b80| 77 69 6e 64 6f 77 2c 20 | 6a 75 73 74 20 64 72 61 |window, |just dra|
|00001b90| 67 20 69 74 20 2a 2f 0d | 09 09 09 09 09 09 69 66 |g it */.|......if|
|00001ba0| 20 28 20 21 28 74 68 65 | 45 76 65 6e 74 2d 3e 6d | ( !(the|Event->m|
|00001bb0| 6f 64 69 66 69 65 72 73 | 20 26 20 63 6d 64 4b 65 |odifiers| & cmdKe|
|00001bc0| 79 29 20 29 0d 09 09 09 | 09 09 09 7b 0d 09 09 09 |y) )....|...{....|
|00001bd0| 09 09 09 09 53 65 6c 65 | 63 74 57 69 6e 64 6f 77 |....Sele|ctWindow|
|00001be0| 20 28 20 74 68 65 57 69 | 6e 64 6f 77 20 29 3b 0d | ( theWi|ndow );.|
|00001bf0| 09 09 09 09 09 09 7d 0d | 09 09 09 09 09 09 0d 09 |......}.|........|
|00001c00| 09 09 09 09 09 44 72 61 | 67 57 69 6e 64 6f 77 20 |.....Dra|gWindow |
|00001c10| 28 20 74 68 65 57 69 6e | 64 6f 77 2c 20 74 68 65 |( theWin|dow, the|
|00001c20| 45 76 65 6e 74 2d 3e 77 | 68 65 72 65 2c 20 26 67 |Event->w|here, &g|
|00001c30| 47 72 61 79 52 67 6e 52 | 65 63 74 20 29 3b 0d 09 |GrayRgnR|ect );..|
|00001c40| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|00001c50| 7d 0d 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 0d |}.....br|eak;....|
|00001c60| 09 09 09 63 61 73 65 20 | 69 6e 47 72 6f 77 20 3a |...case |inGrow :|
|00001c70| 0d 09 09 09 09 2f 2a 20 | 67 72 6f 77 20 62 6f 78 |...../* |grow box|
|00001c80| 20 72 65 67 69 6f 6e 20 | 6f 66 20 61 20 77 69 6e | region |of a win|
|00001c90| 64 6f 77 20 28 6c 6f 77 | 65 72 20 72 69 67 68 74 |dow (low|er right|
|00001ca0| 20 68 61 6e 64 20 63 6f | 72 6e 65 72 29 20 2a 2f | hand co|rner) */|
|00001cb0| 0d 09 09 09 09 57 69 6e | 64 6f 77 47 72 6f 77 20 |.....Win|dowGrow |
|00001cc0| 28 20 74 68 65 57 69 6e | 64 6f 77 2c 20 74 68 65 |( theWin|dow, the|
|00001cd0| 45 76 65 6e 74 2d 3e 77 | 68 65 72 65 20 29 3b 0d |Event->w|here );.|
|00001ce0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 0d |....brea|k;......|
|00001cf0| 09 09 09 63 61 73 65 20 | 69 6e 5a 6f 6f 6d 49 6e |...case |inZoomIn|
|00001d00| 3a 0d 09 09 09 63 61 73 | 65 20 69 6e 5a 6f 6f 6d |:....cas|e inZoom|
|00001d10| 4f 75 74 3a 0d 09 09 09 | 09 2f 2a 20 7a 6f 6f 6d |Out:....|./* zoom|
|00001d20| 20 62 6f 78 20 6f 66 20 | 61 20 77 69 6e 64 6f 77 | box of |a window|
|00001d30| 20 28 75 70 70 65 72 20 | 72 69 67 68 74 20 68 61 | (upper |right ha|
|00001d40| 6e 64 20 63 6f 72 6e 65 | 72 29 20 2a 2f 0d 09 09 |nd corne|r) */...|
|00001d50| 09 09 69 66 20 28 20 54 | 72 61 63 6b 42 6f 78 28 |..if ( T|rackBox(|
|00001d60| 74 68 65 57 69 6e 64 6f | 77 2c 20 74 68 65 45 76 |theWindo|w, theEv|
|00001d70| 65 6e 74 2d 3e 77 68 65 | 72 65 2c 20 77 68 65 72 |ent->whe|re, wher|
|00001d80| 65 29 20 29 0d 09 09 09 | 09 7b 0d 09 09 09 09 09 |e) )....|.{......|
|00001d90| 57 69 6e 64 6f 77 5a 6f | 6f 6d 42 6f 78 20 28 20 |WindowZo|omBox ( |
|00001da0| 74 68 65 57 69 6e 64 6f | 77 2c 20 77 68 65 72 65 |theWindo|w, where|
|00001db0| 20 29 3b 0d 09 09 09 09 | 7d 0d 09 09 09 09 62 72 | );.....|}.....br|
|00001dc0| 65 61 6b 3b 0d 09 09 0d | 09 09 09 63 61 73 65 20 |eak;....|...case |
|00001dd0| 69 6e 47 6f 41 77 61 79 | 20 3a 0d 09 09 09 09 2f |inGoAway| :...../|
|00001de0| 2a 20 63 6c 6f 73 65 20 | 62 6f 78 20 6f 66 20 61 |* close |box of a|
|00001df0| 20 77 69 6e 64 6f 77 20 | 28 75 70 70 65 72 20 6c | window |(upper l|
|00001e00| 65 66 74 20 68 61 6e 64 | 20 63 6f 72 6e 65 72 29 |eft hand| corner)|
|00001e10| 20 2a 2f 0d 09 09 09 09 | 69 66 20 28 20 54 72 61 | */.....|if ( Tra|
|00001e20| 63 6b 47 6f 41 77 61 79 | 20 28 20 74 68 65 57 69 |ckGoAway| ( theWi|
|00001e30| 6e 64 6f 77 2c 20 74 68 | 65 45 76 65 6e 74 2d 3e |ndow, th|eEvent->|
|00001e40| 77 68 65 72 65 20 29 20 | 29 0d 09 09 09 09 7b 0d |where ) |).....{.|
|00001e50| 09 09 09 09 09 57 69 6e | 64 6f 77 43 6c 6f 73 65 |.....Win|dowClose|
|00001e60| 20 28 20 74 68 65 57 69 | 6e 64 6f 77 2c 20 74 68 | ( theWi|ndow, th|
|00001e70| 65 45 76 65 6e 74 2d 3e | 6d 6f 64 69 66 69 65 72 |eEvent->|modifier|
|00001e80| 73 2c 20 74 72 75 65 20 | 29 3b 0d 09 09 09 09 7d |s, true |);.....}|
|00001e90| 0d 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 7d 0d |.....bre|ak;...}.|
|00001ea0| 09 09 0d 09 23 69 66 20 | 6b 43 6f 6d 70 69 6c 65 |....#if |kCompile|
|00001eb0| 57 69 74 68 4d 6f 64 65 | 6c 65 73 73 44 69 61 6c |WithMode|lessDial|
|00001ec0| 6f 67 73 0d 09 7d 0d 09 | 23 65 6e 64 69 66 0d 7d |ogs..}..|#endif.}|
|00001ed0| 20 2f 2a 20 64 6f 4d 6f | 75 73 65 44 6f 77 6e 20 | /* doMo|useDown |
|00001ee0| 2a 2f 0d 0d 0d 2f 2a 20 | 0d 09 2d 3e 6d 65 73 73 |*/.../* |..->mess|
|00001ef0| 61 67 65 09 6c 6f 6e 67 | 09 75 6e 64 65 66 69 6e |age.long|.undefin|
|00001f00| 65 64 0d 09 2d 3e 77 68 | 65 6e 09 09 6c 6f 6e 67 |ed..->wh|en..long|
|00001f10| 09 74 69 6d 65 20 77 68 | 65 6e 20 65 76 65 6e 74 |.time wh|en event|
|00001f20| 20 77 61 73 20 70 6f 73 | 74 65 64 20 28 69 6e 20 | was pos|ted (in |
|00001f30| 74 69 63 6b 73 20 73 69 | 6e 63 65 20 73 79 73 74 |ticks si|nce syst|
|00001f40| 65 6d 20 73 74 61 72 74 | 75 70 29 0d 09 2d 3e 77 |em start|up)..->w|
|00001f50| 68 65 72 65 09 09 50 6f | 69 6e 74 09 63 75 72 73 |here..Po|int.curs|
|00001f60| 6f 72 20 6c 6f 63 61 74 | 69 6f 6e 20 61 74 20 65 |or locat|ion at e|
|00001f70| 76 65 6e 74 20 74 69 6d | 65 0d 09 2d 3e 6d 6f 64 |vent tim|e..->mod|
|00001f80| 69 66 69 65 72 73 09 69 | 6e 74 09 09 73 74 61 74 |ifiers.i|nt..stat|
|00001f90| 65 20 6f 66 20 6d 6f 64 | 69 66 69 65 72 20 6b 65 |e of mod|ifier ke|
|00001fa0| 79 73 20 61 6e 64 20 6d | 6f 75 73 65 20 62 75 74 |ys and m|ouse but|
|00001fb0| 74 6f 6e 20 61 74 20 65 | 76 65 6e 74 20 74 69 6d |ton at e|vent tim|
|00001fc0| 65 20 2a 2f 0d 76 6f 69 | 64 0d 64 6f 4d 6f 75 73 |e */.voi|d.doMous|
|00001fd0| 65 55 70 20 28 20 45 76 | 65 6e 74 52 65 63 6f 72 |eUp ( Ev|entRecor|
|00001fe0| 64 20 2a 74 68 65 45 76 | 65 6e 74 20 29 0d 7b 0d |d *theEv|ent ).{.|
|00001ff0| 09 23 69 66 20 6b 43 6f | 6d 70 69 6c 65 57 69 74 |.#if kCo|mpileWit|
|00002000| 68 4d 6f 64 65 6c 65 73 | 73 44 69 61 6c 6f 67 73 |hModeles|sDialogs|
|00002010| 0d 09 2f 2a 20 6d 6f 64 | 65 6c 65 73 73 20 64 69 |../* mod|eless di|
|00002020| 61 6c 6f 67 73 20 2a 2f | 0d 09 42 6f 6f 6c 65 61 |alogs */|..Boolea|
|00002030| 6e 09 09 64 69 61 6c 6f | 67 45 76 65 6e 74 3b 0d |n..dialo|gEvent;.|
|00002040| 09 42 6f 6f 6c 65 61 6e | 09 09 64 69 61 6c 6f 67 |.Boolean|..dialog|
|00002050| 52 65 73 75 6c 74 3b 0d | 09 44 69 61 6c 6f 67 50 |Result;.|.DialogP|
|00002060| 74 72 09 74 68 65 44 69 | 61 6c 6f 67 3b 0d 09 73 |tr.theDi|alog;..s|
|00002070| 68 6f 72 74 09 09 69 74 | 65 6d 48 69 74 3b 0d 09 |hort..it|emHit;..|
|00002080| 0d 09 2f 2a 20 64 65 74 | 65 72 6d 69 6e 65 20 77 |../* det|ermine w|
|00002090| 68 65 74 68 65 72 20 74 | 68 65 20 65 76 65 6e 74 |hether t|he event|
|000020a0| 20 69 73 20 66 6f 72 20 | 61 20 6d 6f 64 65 6c 65 | is for |a modele|
|000020b0| 73 73 20 64 69 61 6c 6f | 67 20 2a 2f 0d 09 64 69 |ss dialo|g */..di|
|000020c0| 61 6c 6f 67 45 76 65 6e | 74 20 3d 20 49 73 44 69 |alogEven|t = IsDi|
|000020d0| 61 6c 6f 67 45 76 65 6e | 74 20 28 20 74 68 65 45 |alogEven|t ( theE|
|000020e0| 76 65 6e 74 20 29 3b 0d | 0d 09 69 66 20 28 20 64 |vent );.|..if ( d|
|000020f0| 69 61 6c 6f 67 45 76 65 | 6e 74 20 29 0d 09 7b 0d |ialogEve|nt )..{.|
|00002100| 09 09 64 69 61 6c 6f 67 | 52 65 73 75 6c 74 20 3d |..dialog|Result =|
|00002110| 20 44 69 61 6c 6f 67 53 | 65 6c 65 63 74 20 28 20 | DialogS|elect ( |
|00002120| 74 68 65 45 76 65 6e 74 | 2c 20 26 74 68 65 44 69 |theEvent|, &theDi|
|00002130| 61 6c 6f 67 2c 20 26 69 | 74 65 6d 48 69 74 20 29 |alog, &i|temHit )|
|00002140| 3b 0d 09 7d 0d 09 65 6c | 73 65 0d 09 7b 0d 09 7d |;..}..el|se..{..}|
|00002150| 0d 09 23 65 6e 64 69 66 | 0d 7d 20 2f 2a 20 64 6f |..#endif|.} /* do|
|00002160| 4d 6f 75 73 65 55 70 20 | 2a 2f 0d 0d 0d 2f 2a 2a |MouseUp |*/.../**|
|00002170| 20 20 4b 65 79 62 6f 61 | 72 64 20 45 76 65 6e 74 | Keyboa|rd Event|
|00002180| 73 20 20 2a 2a 2f 0d 23 | 70 72 61 67 6d 61 20 6d |s **/.#|pragma m|
|00002190| 61 72 6b 20 2d 0d 0d 2f | 2a 20 0d 09 2d 3e 6d 65 |ark -../|* ..->me|
|000021a0| 73 73 61 67 65 09 6c 6f | 6e 67 09 63 68 61 72 20 |ssage.lo|ng.char |
|000021b0| 61 6e 64 20 76 69 72 74 | 75 61 6c 20 6b 65 79 20 |and virt|ual key |
|000021c0| 63 6f 64 65 73 20 69 6e | 20 6c 6f 77 2d 6f 72 64 |codes in| low-ord|
|000021d0| 65 72 20 77 6f 72 64 2e | 0d 09 09 09 09 09 09 41 |er word.|.......A|
|000021e0| 44 42 20 61 64 64 72 65 | 73 73 20 69 6e 20 6c 6f |DB addre|ss in lo|
|000021f0| 77 20 62 79 74 65 20 6f | 66 20 68 69 67 68 2d 6f |w byte o|f high-o|
|00002200| 72 64 65 72 20 77 6f 72 | 64 0d 09 2d 3e 77 68 65 |rder wor|d..->whe|
|00002210| 6e 09 09 6c 6f 6e 67 09 | 74 69 6d 65 20 77 68 65 |n..long.|time whe|
|00002220| 6e 20 65 76 65 6e 74 20 | 77 61 73 20 70 6f 73 74 |n event |was post|
|00002230| 65 64 20 28 69 6e 20 74 | 69 63 6b 73 20 73 69 6e |ed (in t|icks sin|
|00002240| 63 65 20 73 79 73 74 65 | 6d 20 73 74 61 72 74 75 |ce syste|m startu|
|00002250| 70 29 0d 09 2d 3e 77 68 | 65 72 65 09 09 50 6f 69 |p)..->wh|ere..Poi|
|00002260| 6e 74 09 63 75 72 73 6f | 72 20 6c 6f 63 61 74 69 |nt.curso|r locati|
|00002270| 6f 6e 20 61 74 20 65 76 | 65 6e 74 20 74 69 6d 65 |on at ev|ent time|
|00002280| 0d 09 2d 3e 6d 6f 64 69 | 66 69 65 72 73 09 69 6e |..->modi|fiers.in|
|00002290| 74 09 09 73 74 61 74 65 | 20 6f 66 20 6d 6f 64 69 |t..state| of modi|
|000022a0| 66 69 65 72 20 6b 65 79 | 73 20 61 6e 64 20 6d 6f |fier key|s and mo|
|000022b0| 75 73 65 20 62 75 74 74 | 6f 6e 20 61 74 20 65 76 |use butt|on at ev|
|000022c0| 65 6e 74 20 74 69 6d 65 | 0d 09 49 4d 2d 4d 54 45 |ent time|..IM-MTE|
|000022d0| 20 32 2d 34 34 20 2a 2f | 0d 76 6f 69 64 0d 64 6f | 2-44 */|.void.do|
|000022e0| 4b 65 79 44 6f 77 6e 20 | 28 20 45 76 65 6e 74 52 |KeyDown |( EventR|
|000022f0| 65 63 6f 72 64 20 2a 74 | 68 65 45 76 65 6e 74 20 |ecord *t|heEvent |
|00002300| 29 0d 7b 0d 09 63 68 61 | 72 09 74 68 65 43 68 61 |).{..cha|r.theCha|
|00002310| 72 3b 0d 09 0d 09 2f 2a | 20 72 65 73 65 74 20 27 |r;..../*| reset '|
|00002320| 71 75 69 74 20 6f 6e 20 | 69 64 6c 65 20 74 69 6d |quit on |idle tim|
|00002330| 65 27 20 74 69 6d 65 72 | 20 2a 2f 0d 09 52 65 73 |e' timer| */..Res|
|00002340| 65 74 51 75 69 74 49 64 | 6c 65 54 69 6d 65 72 28 |etQuitId|leTimer(|
|00002350| 29 3b 0d 09 0d 09 2f 2a | 20 74 68 65 20 63 68 61 |);..../*| the cha|
|00002360| 72 61 63 74 65 72 20 62 | 65 69 6e 67 20 70 72 65 |racter b|eing pre|
|00002370| 73 73 65 64 20 69 73 20 | 69 6e 20 74 68 65 20 6d |ssed is |in the m|
|00002380| 65 73 73 61 67 65 20 6f | 66 20 74 68 65 20 65 76 |essage o|f the ev|
|00002390| 65 6e 74 20 72 65 63 6f | 72 64 20 2a 2f 0d 09 74 |ent reco|rd */..t|
|000023a0| 68 65 43 68 61 72 20 3d | 20 74 68 65 45 76 65 6e |heChar =| theEven|
|000023b0| 74 2d 3e 6d 65 73 73 61 | 67 65 20 26 20 63 68 61 |t->messa|ge & cha|
|000023c0| 72 43 6f 64 65 4d 61 73 | 6b 3b 0d 09 0d 09 69 66 |rCodeMas|k;....if|
|000023d0| 20 28 20 74 68 65 45 76 | 65 6e 74 2d 3e 6d 6f 64 | ( theEv|ent->mod|
|000023e0| 69 66 69 65 72 73 20 26 | 20 63 6d 64 4b 65 79 20 |ifiers &| cmdKey |
|000023f0| 29 0d 09 7b 0d 09 09 2f | 2a 20 69 66 20 74 68 65 |)..{.../|* if the|
|00002400| 20 63 6f 6d 6d 61 6e 64 | 20 6b 65 79 20 69 73 20 | command| key is |
|00002410| 62 65 69 6e 67 20 68 65 | 6c 64 20 64 6f 77 6e 2c |being he|ld down,|
|00002420| 20 74 72 65 61 74 20 61 | 73 20 6d 65 6e 75 20 72 | treat a|s menu r|
|00002430| 65 71 75 65 73 74 20 2a | 2f 0d 09 09 61 64 6a 75 |equest *|/...adju|
|00002440| 73 74 4d 65 6e 75 73 09 | 28 29 3b 0d 09 09 64 6f |stMenus.|();...do|
|00002450| 4d 65 6e 75 09 09 28 20 | 4d 65 6e 75 4b 65 79 20 |Menu..( |MenuKey |
|00002460| 28 74 68 65 43 68 61 72 | 29 2c 20 74 68 65 45 76 |(theChar|), theEv|
|00002470| 65 6e 74 2d 3e 6d 6f 64 | 69 66 69 65 72 73 20 29 |ent->mod|ifiers )|
|00002480| 3b 0d 09 7d 0d 09 65 6c | 73 65 0d 09 7b 0d 09 09 |;..}..el|se..{...|
|00002490| 2f 2a 20 68 61 6e 64 6c | 65 20 72 65 67 75 6c 61 |/* handl|e regula|
|000024a0| 72 20 6b 65 79 70 72 65 | 73 73 20 2a 2f 0d 09 09 |r keypre|ss */...|
|000024b0| 64 6f 4b 65 79 50 72 65 | 73 73 20 28 20 74 68 65 |doKeyPre|ss ( the|
|000024c0| 45 76 65 6e 74 20 29 3b | 0d 09 7d 0d 7d 20 2f 2a |Event );|..}.} /*|
|000024d0| 20 64 6f 4b 65 79 44 6f | 77 6e 20 2a 2f 0d 0d 0d | doKeyDo|wn */...|
|000024e0| 2f 2a 20 0d 09 2d 3e 6d | 65 73 73 61 67 65 09 6c |/* ..->m|essage.l|
|000024f0| 6f 6e 67 09 63 68 61 72 | 20 61 6e 64 20 76 69 72 |ong.char| and vir|
|00002500| 74 75 61 6c 20 6b 65 79 | 20 63 6f 64 65 73 20 69 |tual key| codes i|
|00002510| 6e 20 6c 6f 77 2d 6f 72 | 64 65 72 20 77 6f 72 64 |n low-or|der word|
|00002520| 2e 0d 09 09 09 09 09 09 | 41 44 42 20 61 64 64 72 |........|ADB addr|
|00002530| 65 73 73 20 69 6e 20 6c | 6f 77 20 62 79 74 65 20 |ess in l|ow byte |
|00002540| 6f 66 20 68 69 67 68 2d | 6f 72 64 65 72 20 77 6f |of high-|order wo|
|00002550| 72 64 0d 09 2d 3e 77 68 | 65 6e 09 09 6c 6f 6e 67 |rd..->wh|en..long|
|00002560| 09 74 69 6d 65 20 77 68 | 65 6e 20 65 76 65 6e 74 |.time wh|en event|
|00002570| 20 77 61 73 20 70 6f 73 | 74 65 64 20 28 69 6e 20 | was pos|ted (in |
|00002580| 74 69 63 6b 73 20 73 69 | 6e 63 65 20 73 79 73 74 |ticks si|nce syst|
|00002590| 65 6d 20 73 74 61 72 74 | 75 70 29 0d 09 2d 3e 77 |em start|up)..->w|
|000025a0| 68 65 72 65 09 09 50 6f | 69 6e 74 09 63 75 72 73 |here..Po|int.curs|
|000025b0| 6f 72 20 6c 6f 63 61 74 | 69 6f 6e 20 61 74 20 65 |or locat|ion at e|
|000025c0| 76 65 6e 74 20 74 69 6d | 65 0d 09 2d 3e 6d 6f 64 |vent tim|e..->mod|
|000025d0| 69 66 69 65 72 73 09 69 | 6e 74 09 09 73 74 61 74 |ifiers.i|nt..stat|
|000025e0| 65 20 6f 66 20 6d 6f 64 | 69 66 69 65 72 20 6b 65 |e of mod|ifier ke|
|000025f0| 79 73 20 61 6e 64 20 6d | 6f 75 73 65 20 62 75 74 |ys and m|ouse but|
|00002600| 74 6f 6e 20 61 74 20 65 | 76 65 6e 74 20 74 69 6d |ton at e|vent tim|
|00002610| 65 20 2a 2f 0d 76 6f 69 | 64 0d 64 6f 41 75 74 6f |e */.voi|d.doAuto|
|00002620| 4b 65 79 20 28 20 45 76 | 65 6e 74 52 65 63 6f 72 |Key ( Ev|entRecor|
|00002630| 64 20 2a 74 68 65 45 76 | 65 6e 74 20 29 0d 7b 0d |d *theEv|ent ).{.|
|00002640| 09 69 66 20 28 20 74 68 | 65 45 76 65 6e 74 2d 3e |.if ( th|eEvent->|
|00002650| 6d 6f 64 69 66 69 65 72 | 73 20 26 20 63 6d 64 4b |modifier|s & cmdK|
|00002660| 65 79 20 29 0d 09 7b 0d | 09 09 2f 2a 20 64 6f 6e |ey )..{.|../* don|
|00002670| 27 74 20 64 6f 20 61 6e | 79 74 68 69 6e 67 2e 20 |'t do an|ything. |
|00002680| 43 6f 6d 6d 61 6e 64 20 | 6b 65 79 73 20 73 68 6f |Command |keys sho|
|00002690| 75 6c 64 20 6e 6f 74 20 | 61 75 74 6f 2d 72 65 70 |uld not |auto-rep|
|000026a0| 65 61 74 2e 20 2a 2f 0d | 09 7d 0d 09 65 6c 73 65 |eat. */.|.}..else|
|000026b0| 0d 09 7b 0d 09 09 2f 2a | 20 68 61 6e 64 6c 65 20 |..{.../*| handle |
|000026c0| 72 65 67 75 6c 61 72 20 | 6b 65 79 70 72 65 73 73 |regular |keypress|
|000026d0| 20 2a 2f 0d 09 09 64 6f | 4b 65 79 50 72 65 73 73 | */...do|KeyPress|
|000026e0| 20 28 20 74 68 65 45 76 | 65 6e 74 20 29 3b 0d 09 | ( theEv|ent );..|
|000026f0| 7d 0d 7d 20 2f 2a 20 64 | 6f 41 75 74 6f 4b 65 79 |}.} /* d|oAutoKey|
|00002700| 20 2a 2f 0d 0d 0d 2f 2a | 20 0d 09 2d 3e 6d 65 73 | */.../*| ..->mes|
|00002710| 73 61 67 65 09 6c 6f 6e | 67 09 63 68 61 72 20 61 |sage.lon|g.char a|
|00002720| 6e 64 20 76 69 72 74 75 | 61 6c 20 6b 65 79 20 63 |nd virtu|al key c|
|00002730| 6f 64 65 73 20 69 6e 20 | 6c 6f 77 2d 6f 72 64 65 |odes in |low-orde|
|00002740| 72 20 77 6f 72 64 2e 0d | 09 09 09 09 09 09 41 44 |r word..|......AD|
|00002750| 42 20 61 64 64 72 65 73 | 73 20 69 6e 20 6c 6f 77 |B addres|s in low|
|00002760| 20 62 79 74 65 20 6f 66 | 20 68 69 67 68 2d 6f 72 | byte of| high-or|
|00002770| 64 65 72 20 77 6f 72 64 | 0d 09 2d 3e 77 68 65 6e |der word|..->when|
|00002780| 09 09 6c 6f 6e 67 09 74 | 69 6d 65 20 77 68 65 6e |..long.t|ime when|
|00002790| 20 65 76 65 6e 74 20 77 | 61 73 20 70 6f 73 74 65 | event w|as poste|
|000027a0| 64 20 28 69 6e 20 74 69 | 63 6b 73 20 73 69 6e 63 |d (in ti|cks sinc|
|000027b0| 65 20 73 79 73 74 65 6d | 20 73 74 61 72 74 75 70 |e system| startup|
|000027c0| 29 0d 09 2d 3e 77 68 65 | 72 65 09 09 50 6f 69 6e |)..->whe|re..Poin|
|000027d0| 74 09 63 75 72 73 6f 72 | 20 6c 6f 63 61 74 69 6f |t.cursor| locatio|
|000027e0| 6e 20 61 74 20 65 76 65 | 6e 74 20 74 69 6d 65 0d |n at eve|nt time.|
|000027f0| 09 2d 3e 6d 6f 64 69 66 | 69 65 72 73 09 69 6e 74 |.->modif|iers.int|
|00002800| 09 09 73 74 61 74 65 20 | 6f 66 20 6d 6f 64 69 66 |..state |of modif|
|00002810| 69 65 72 20 6b 65 79 73 | 20 61 6e 64 20 6d 6f 75 |ier keys| and mou|
|00002820| 73 65 20 62 75 74 74 6f | 6e 20 61 74 20 65 76 65 |se butto|n at eve|
|00002830| 6e 74 20 74 69 6d 65 20 | 2a 2f 0d 76 6f 69 64 0d |nt time |*/.void.|
|00002840| 64 6f 4b 65 79 55 70 20 | 28 20 45 76 65 6e 74 52 |doKeyUp |( EventR|
|00002850| 65 63 6f 72 64 20 2a 74 | 68 65 45 76 65 6e 74 20 |ecord *t|heEvent |
|00002860| 29 0d 7b 0d 09 0d 7d 20 | 2f 2a 20 64 6f 4b 65 79 |).{...} |/* doKey|
|00002870| 55 70 20 2a 2f 0d 0d 0d | 2f 2a 20 68 61 6e 64 6c |Up */...|/* handl|
|00002880| 65 20 72 65 67 75 6c 61 | 72 20 6b 65 79 70 72 65 |e regula|r keypre|
|00002890| 73 73 0d 09 2d 3e 6d 65 | 73 73 61 67 65 09 6c 6f |ss..->me|ssage.lo|
|000028a0| 6e 67 09 63 68 61 72 20 | 61 6e 64 20 76 69 72 74 |ng.char |and virt|
|000028b0| 75 61 6c 20 6b 65 79 20 | 63 6f 64 65 73 20 69 6e |ual key |codes in|
|000028c0| 20 6c 6f 77 2d 6f 72 64 | 65 72 20 77 6f 72 64 2e | low-ord|er word.|
|000028d0| 0d 09 09 09 09 09 09 41 | 44 42 20 61 64 64 72 65 |.......A|DB addre|
|000028e0| 73 73 20 69 6e 20 6c 6f | 77 20 62 79 74 65 20 6f |ss in lo|w byte o|
|000028f0| 66 20 68 69 67 68 2d 6f | 72 64 65 72 20 77 6f 72 |f high-o|rder wor|
|00002900| 64 0d 09 2d 3e 77 68 65 | 6e 09 09 6c 6f 6e 67 09 |d..->whe|n..long.|
|00002910| 74 69 6d 65 20 77 68 65 | 6e 20 65 76 65 6e 74 20 |time whe|n event |
|00002920| 77 61 73 20 70 6f 73 74 | 65 64 20 28 69 6e 20 74 |was post|ed (in t|
|00002930| 69 63 6b 73 20 73 69 6e | 63 65 20 73 79 73 74 65 |icks sin|ce syste|
|00002940| 6d 20 73 74 61 72 74 75 | 70 29 0d 09 2d 3e 77 68 |m startu|p)..->wh|
|00002950| 65 72 65 09 09 50 6f 69 | 6e 74 09 63 75 72 73 6f |ere..Poi|nt.curso|
|00002960| 72 20 6c 6f 63 61 74 69 | 6f 6e 20 61 74 20 65 76 |r locati|on at ev|
|00002970| 65 6e 74 20 74 69 6d 65 | 0d 09 2d 3e 6d 6f 64 69 |ent time|..->modi|
|00002980| 66 69 65 72 73 09 69 6e | 74 09 09 73 74 61 74 65 |fiers.in|t..state|
|00002990| 20 6f 66 20 6d 6f 64 69 | 66 69 65 72 20 6b 65 79 | of modi|fier key|
|000029a0| 73 20 61 6e 64 20 6d 6f | 75 73 65 20 62 75 74 74 |s and mo|use butt|
|000029b0| 6f 6e 20 61 74 20 65 76 | 65 6e 74 20 74 69 6d 65 |on at ev|ent time|
|000029c0| 0d 09 49 4d 2d 4d 54 45 | 3a 20 32 2d 34 34 2c 34 |..IM-MTE|: 2-44,4|
|000029d0| 35 20 2a 2f 0d 73 74 61 | 74 69 63 20 76 6f 69 64 |5 */.sta|tic void|
|000029e0| 0d 64 6f 4b 65 79 50 72 | 65 73 73 20 28 20 45 76 |.doKeyPr|ess ( Ev|
|000029f0| 65 6e 74 52 65 63 6f 72 | 64 20 2a 74 68 65 45 76 |entRecor|d *theEv|
|00002a00| 65 6e 74 20 29 0d 7b 0d | 09 2f 2a 20 49 66 20 79 |ent ).{.|./* If y|
|00002a10| 6f 75 20 61 64 64 20 77 | 69 6e 64 6f 77 73 20 74 |ou add w|indows t|
|00002a20| 68 61 74 20 61 6c 6c 6f | 77 20 66 6f 72 20 74 65 |hat allo|w for te|
|00002a30| 78 74 20 65 6e 74 72 79 | 20 6f 72 20 79 6f 75 20 |xt entry| or you |
|00002a40| 61 63 63 65 70 74 20 6e | 6f 6e 2d 63 6f 6d 6d 61 |accept n|on-comma|
|00002a50| 6e 64 2d 6b 65 79 0d 09 | 09 6b 65 79 62 6f 61 72 |nd-key..|.keyboar|
|00002a60| 64 20 69 6e 70 75 74 2c | 20 79 6f 75 20 6e 65 65 |d input,| you nee|
|00002a70| 64 20 74 6f 20 73 75 70 | 70 6f 72 74 20 74 68 69 |d to sup|port thi|
|00002a80| 73 20 66 75 6e 63 74 69 | 6f 6e 2e 20 2a 2f 0d 09 |s functi|on. */..|
|00002a90| 23 69 66 20 6b 43 6f 6d | 70 69 6c 65 57 69 74 68 |#if kCom|pileWith|
|00002aa0| 4b 65 79 62 6f 61 72 64 | 45 76 65 6e 74 73 0d 09 |Keyboard|Events..|
|00002ab0| 4d 79 4b 65 79 50 72 65 | 73 73 20 28 20 74 68 65 |MyKeyPre|ss ( the|
|00002ac0| 45 76 65 6e 74 20 29 3b | 0d 09 23 65 6e 64 69 66 |Event );|..#endif|
|00002ad0| 0d 7d 20 2f 2a 20 64 6f | 4b 65 79 50 72 65 73 73 |.} /* do|KeyPress|
|00002ae0| 20 2a 2f 0d 0d 0d 2f 2a | 2a 20 20 4f 74 68 65 72 | */.../*|* Other|
|00002af0| 20 45 76 65 6e 74 73 20 | 20 2a 2a 2f 0d 23 70 72 | Events | **/.#pr|
|00002b00| 61 67 6d 61 20 6d 61 72 | 6b 20 2d 0d 0d 2f 2a 20 |agma mar|k -../* |
|00002b10| 48 61 6e 64 6c 65 20 61 | 63 74 69 76 61 74 65 20 |Handle a|ctivate |
|00002b20| 65 76 65 6e 74 20 2d 20 | 61 20 77 69 6e 64 6f 77 |event - |a window|
|00002b30| 20 68 61 73 20 62 65 65 | 6e 20 62 72 6f 75 67 68 | has bee|n brough|
|00002b40| 74 20 74 6f 20 66 72 6f | 6e 74 2c 20 6f 72 20 61 |t to fro|nt, or a|
|00002b50| 20 77 69 6e 64 6f 77 0d | 09 74 68 61 74 20 77 61 | window.|.that wa|
|00002b60| 73 20 69 6e 20 66 72 6f | 6e 74 20 69 73 20 6e 6f |s in fro|nt is no|
|00002b70| 20 6c 6f 6e 67 65 72 2e | 0d 09 2d 3e 6d 65 73 73 | longer.|..->mess|
|00002b80| 61 67 65 09 6c 6f 6e 67 | 09 77 69 6e 64 6f 77 20 |age.long|.window |
|00002b90| 70 74 72 20 66 6f 72 20 | 77 69 6e 64 6f 77 20 74 |ptr for |window t|
|00002ba0| 6f 20 64 65 2f 61 63 74 | 69 76 61 74 65 0d 09 2d |o de/act|ivate..-|
|00002bb0| 3e 77 68 65 6e 09 09 6c | 6f 6e 67 09 74 69 6d 65 |>when..l|ong.time|
|00002bc0| 20 77 68 65 6e 20 65 76 | 65 6e 74 20 77 61 73 20 | when ev|ent was |
|00002bd0| 70 6f 73 74 65 64 20 28 | 69 6e 20 74 69 63 6b 73 |posted (|in ticks|
|00002be0| 20 73 69 6e 63 65 20 73 | 79 73 74 65 6d 20 73 74 | since s|ystem st|
|00002bf0| 61 72 74 75 70 29 0d 09 | 2d 3e 77 68 65 72 65 09 |artup)..|->where.|
|00002c00| 09 50 6f 69 6e 74 09 63 | 75 72 73 6f 72 20 6c 6f |.Point.c|ursor lo|
|00002c10| 63 61 74 69 6f 6e 20 61 | 74 20 65 76 65 6e 74 20 |cation a|t event |
|00002c20| 74 69 6d 65 0d 09 2d 3e | 6d 6f 64 69 66 69 65 72 |time..->|modifier|
|00002c30| 73 09 69 6e 74 09 09 73 | 74 61 74 65 20 6f 66 20 |s.int..s|tate of |
|00002c40| 6d 6f 64 69 66 69 65 72 | 20 6b 65 79 73 20 61 6e |modifier| keys an|
|00002c50| 64 20 6d 6f 75 73 65 20 | 62 75 74 74 6f 6e 20 61 |d mouse |button a|
|00002c60| 74 20 65 76 65 6e 74 20 | 74 69 6d 65 0d 09 09 09 |t event |time....|
|00002c70| 09 09 09 61 6e 64 20 77 | 68 65 74 68 65 72 20 77 |...and w|hether w|
|00002c80| 69 6e 64 6f 77 20 73 68 | 6f 75 6c 64 20 62 65 20 |indow sh|ould be |
|00002c90| 61 63 74 69 76 61 74 65 | 64 20 6f 72 20 64 65 61 |activate|d or dea|
|00002ca0| 63 74 69 76 61 74 65 64 | 0d 09 49 4d 2d 4d 54 45 |ctivated|..IM-MTE|
|00002cb0| 3a 20 32 2d 35 30 2d 35 | 35 20 2a 2f 0d 76 6f 69 |: 2-50-5|5 */.voi|
|00002cc0| 64 0d 64 6f 41 63 74 69 | 76 61 74 65 45 76 65 6e |d.doActi|vateEven|
|00002cd0| 74 20 28 20 45 76 65 6e | 74 52 65 63 6f 72 64 20 |t ( Even|tRecord |
|00002ce0| 2a 74 68 65 45 76 65 6e | 74 20 29 0d 7b 0d 09 57 |*theEven|t ).{..W|
|00002cf0| 69 6e 64 6f 77 50 74 72 | 09 74 68 65 57 69 6e 64 |indowPtr|.theWind|
|00002d00| 6f 77 3b 0d 09 42 6f 6f | 6c 65 61 6e 09 09 62 65 |ow;..Boo|lean..be|
|00002d10| 63 6f 6d 69 6e 67 41 63 | 74 69 76 65 3b 0d 09 0d |comingAc|tive;...|
|00002d20| 09 2f 2a 20 a5 a5 a5 20 | 72 65 73 65 74 20 27 71 |./* ... |reset 'q|
|00002d30| 75 69 74 20 6f 6e 20 69 | 64 6c 65 20 74 69 6d 65 |uit on i|dle time|
|00002d40| 27 20 74 69 6d 65 72 20 | 2a 2f 0d 09 52 65 73 65 |' timer |*/..Rese|
|00002d50| 74 51 75 69 74 49 64 6c | 65 54 69 6d 65 72 28 29 |tQuitIdl|eTimer()|
|00002d60| 3b 0d 09 0d 09 74 68 65 | 57 69 6e 64 6f 77 09 09 |;....the|Window..|
|00002d70| 3d 20 28 57 69 6e 64 6f | 77 50 74 72 29 20 74 68 |= (Windo|wPtr) th|
|00002d80| 65 45 76 65 6e 74 2d 3e | 6d 65 73 73 61 67 65 3b |eEvent->|message;|
|00002d90| 0d 09 62 65 63 6f 6d 69 | 6e 67 41 63 74 69 76 65 |..becomi|ngActive|
|00002da0| 09 3d 20 28 74 68 65 45 | 76 65 6e 74 2d 3e 6d 6f |.= (theE|vent->mo|
|00002db0| 64 69 66 69 65 72 73 20 | 26 20 61 63 74 69 76 65 |difiers |& active|
|00002dc0| 46 6c 61 67 29 20 21 3d | 20 6e 69 6c 3b 0d 09 0d |Flag) !=| nil;...|
|00002dd0| 09 73 77 69 74 63 68 20 | 28 20 57 69 6e 64 6f 77 |.switch |( Window|
|00002de0| 54 79 70 65 28 74 68 65 | 57 69 6e 64 6f 77 29 20 |Type(the|Window) |
|00002df0| 29 0d 09 7b 0d 09 09 63 | 61 73 65 20 57 69 6e 64 |)..{...c|ase Wind|
|00002e00| 6f 77 5f 6e 6f 6e 65 20 | 3a 0d 09 09 09 62 72 65 |ow_none |:....bre|
|00002e10| 61 6b 3b 0d 09 09 0d 09 | 09 63 61 73 65 20 57 69 |ak;.....|.case Wi|
|00002e20| 6e 64 6f 77 5f 55 4e 4b | 4e 4f 57 4e 20 3a 0d 09 |ndow_UNK|NOWN :..|
|00002e30| 09 09 6d 79 5f 61 73 73 | 65 72 74 20 28 20 6b 46 |..my_ass|ert ( kF|
|00002e40| 6f 72 63 65 41 73 73 65 | 72 74 2c 20 22 5c 70 64 |orceAsse|rt, "\pd|
|00002e50| 6f 41 63 74 69 76 61 74 | 65 45 76 65 6e 74 3a 20 |oActivat|eEvent: |
|00002e60| 55 6e 6b 6e 6f 77 6e 20 | 77 69 6e 64 6f 77 20 74 |Unknown |window t|
|00002e70| 79 70 65 22 20 29 3b 0d | 09 09 09 62 72 65 61 6b |ype" );.|...break|
|00002e80| 3b 0d 09 09 0d 09 09 64 | 65 66 61 75 6c 74 20 3a |;......d|efault :|
|00002e90| 0d 09 09 09 57 69 6e 64 | 6f 77 41 63 74 69 76 61 |....Wind|owActiva|
|00002ea0| 74 65 20 28 20 74 68 65 | 57 69 6e 64 6f 77 2c 20 |te ( the|Window, |
|00002eb0| 62 65 63 6f 6d 69 6e 67 | 41 63 74 69 76 65 2c 20 |becoming|Active, |
|00002ec0| 74 68 65 45 76 65 6e 74 | 20 29 3b 0d 09 09 09 62 |theEvent| );....b|
|00002ed0| 72 65 61 6b 3b 0d 09 7d | 0d 7d 20 2f 2a 20 64 6f |reak;..}|.} /* do|
|00002ee0| 41 63 74 69 76 61 74 65 | 45 76 65 6e 74 20 2a 2f |Activate|Event */|
|00002ef0| 0d 0d 0d 2f 2a 20 41 20 | 77 69 6e 64 6f 77 20 6e |.../* A |window n|
|00002f00| 65 65 64 73 20 74 6f 20 | 62 65 20 75 70 64 61 74 |eeds to |be updat|
|00002f10| 65 64 2e 0d 09 2d 3e 6d | 65 73 73 61 67 65 09 6c |ed...->m|essage.l|
|00002f20| 6f 6e 67 09 77 69 6e 64 | 6f 77 20 70 74 72 20 66 |ong.wind|ow ptr f|
|00002f30| 6f 72 20 77 69 6e 64 6f | 77 20 74 6f 20 75 70 64 |or windo|w to upd|
|00002f40| 61 74 65 0d 09 2d 3e 77 | 68 65 6e 09 09 6c 6f 6e |ate..->w|hen..lon|
|00002f50| 67 09 74 69 6d 65 20 77 | 68 65 6e 20 65 76 65 6e |g.time w|hen even|
|00002f60| 74 20 77 61 73 20 70 6f | 73 74 65 64 20 28 69 6e |t was po|sted (in|
|00002f70| 20 74 69 63 6b 73 20 73 | 69 6e 63 65 20 73 79 73 | ticks s|ince sys|
|00002f80| 74 65 6d 20 73 74 61 72 | 74 75 70 29 0d 09 2d 3e |tem star|tup)..->|
|00002f90| 77 68 65 72 65 09 09 50 | 6f 69 6e 74 09 63 75 72 |where..P|oint.cur|
|00002fa0| 73 6f 72 20 6c 6f 63 61 | 74 69 6f 6e 20 61 74 20 |sor loca|tion at |
|00002fb0| 65 76 65 6e 74 20 74 69 | 6d 65 0d 09 2d 3e 6d 6f |event ti|me..->mo|
|00002fc0| 64 69 66 69 65 72 73 09 | 69 6e 74 09 09 73 74 61 |difiers.|int..sta|
|00002fd0| 74 65 20 6f 66 20 6d 6f | 64 69 66 69 65 72 20 6b |te of mo|difier k|
|00002fe0| 65 79 73 20 61 6e 64 20 | 6d 6f 75 73 65 20 62 75 |eys and |mouse bu|
|00002ff0| 74 74 6f 6e 20 61 74 20 | 65 76 65 6e 74 20 74 69 |tton at |event ti|
|00003000| 6d 65 0d 09 49 4d 2d 4d | 54 45 3a 20 32 2d 34 37 |me..IM-M|TE: 2-47|
|00003010| 2d 35 30 20 2a 2f 0d 76 | 6f 69 64 0d 64 6f 55 70 |-50 */.v|oid.doUp|
|00003020| 64 61 74 65 45 76 65 6e | 74 20 28 20 45 76 65 6e |dateEven|t ( Even|
|00003030| 74 52 65 63 6f 72 64 20 | 2a 74 68 65 45 76 65 6e |tRecord |*theEven|
|00003040| 74 20 29 0d 7b 0d 09 57 | 69 6e 64 6f 77 50 74 72 |t ).{..W|indowPtr|
|00003050| 09 09 74 68 65 57 69 6e | 64 6f 77 3b 0d 09 0d 09 |..theWin|dow;....|
|00003060| 74 68 65 57 69 6e 64 6f | 77 09 3d 20 28 57 69 6e |theWindo|w.= (Win|
|00003070| 64 6f 77 50 74 72 29 20 | 28 74 68 65 45 76 65 6e |dowPtr) |(theEven|
|00003080| 74 2d 3e 6d 65 73 73 61 | 67 65 29 3b 0d 09 0d 09 |t->messa|ge);....|
|00003090| 69 66 20 28 20 74 68 65 | 57 69 6e 64 6f 77 20 21 |if ( the|Window !|
|000030a0| 3d 20 6e 69 6c 20 29 0d | 09 7b 0d 09 09 57 69 6e |= nil ).|.{...Win|
|000030b0| 64 6f 77 55 70 64 61 74 | 65 20 28 20 74 68 65 57 |dowUpdat|e ( theW|
|000030c0| 69 6e 64 6f 77 20 29 3b | 0d 09 7d 0d 7d 20 2f 2a |indow );|..}.} /*|
|000030d0| 20 64 6f 55 70 64 61 74 | 65 45 76 65 6e 74 20 2a | doUpdat|eEvent *|
|000030e0| 2f 0d 0d 0d 2f 2a 0d 09 | 2d 3e 6d 65 73 73 61 67 |/.../*..|->messag|
|000030f0| 65 09 6c 6f 6e 67 09 77 | 69 6e 64 6f 77 20 70 74 |e.long.w|indow pt|
|00003100| 72 20 66 6f 72 20 77 69 | 6e 64 6f 77 20 74 6f 20 |r for wi|ndow to |
|00003110| 64 65 2f 61 63 74 69 76 | 61 74 65 0d 09 2d 3e 77 |de/activ|ate..->w|
|00003120| 68 65 6e 09 09 6c 6f 6e | 67 09 74 69 6d 65 20 77 |hen..lon|g.time w|
|00003130| 68 65 6e 20 65 76 65 6e | 74 20 77 61 73 20 70 6f |hen even|t was po|
|00003140| 73 74 65 64 20 28 69 6e | 20 74 69 63 6b 73 20 73 |sted (in| ticks s|
|00003150| 69 6e 63 65 20 73 79 73 | 74 65 6d 20 73 74 61 72 |ince sys|tem star|
|00003160| 74 75 70 29 0d 09 2d 3e | 77 68 65 72 65 09 09 50 |tup)..->|where..P|
|00003170| 6f 69 6e 74 09 63 75 72 | 73 6f 72 20 6c 6f 63 61 |oint.cur|sor loca|
|00003180| 74 69 6f 6e 20 61 74 20 | 65 76 65 6e 74 20 74 69 |tion at |event ti|
|00003190| 6d 65 0d 09 2d 3e 6d 6f | 64 69 66 69 65 72 73 09 |me..->mo|difiers.|
|000031a0| 69 6e 74 09 09 73 74 61 | 74 65 20 6f 66 20 6d 6f |int..sta|te of mo|
|000031b0| 64 69 66 69 65 72 20 6b | 65 79 73 20 61 6e 64 20 |difier k|eys and |
|000031c0| 6d 6f 75 73 65 20 62 75 | 74 74 6f 6e 20 61 74 20 |mouse bu|tton at |
|000031d0| 65 76 65 6e 74 20 74 69 | 6d 65 0d 09 09 09 09 09 |event ti|me......|
|000031e0| 09 61 6e 64 20 77 68 65 | 74 68 65 72 20 77 69 6e |.and whe|ther win|
|000031f0| 64 6f 77 20 73 68 6f 75 | 6c 64 20 62 65 20 61 63 |dow shou|ld be ac|
|00003200| 74 69 76 61 74 65 64 20 | 6f 72 20 64 65 61 63 74 |tivated |or deact|
|00003210| 69 76 61 74 65 64 0d 09 | 49 4d 2d 4d 54 45 3a 20 |ivated..|IM-MTE: |
|00003220| 32 2d 35 38 2d 36 32 20 | 2a 2f 0d 76 6f 69 64 0d |2-58-62 |*/.void.|
|00003230| 64 6f 4f 73 45 76 74 20 | 28 20 63 6f 6e 73 74 20 |doOsEvt |( const |
|00003240| 45 76 65 6e 74 52 65 63 | 6f 72 64 20 2a 74 68 65 |EventRec|ord *the|
|00003250| 45 76 65 6e 74 20 29 0d | 7b 0d 09 57 69 6e 64 6f |Event ).|{..Windo|
|00003260| 77 50 74 72 09 74 68 65 | 57 69 6e 64 6f 77 3b 0d |wPtr.the|Window;.|
|00003270| 09 0d 09 73 77 69 74 63 | 68 20 28 20 28 74 68 65 |...switc|h ( (the|
|00003280| 45 76 65 6e 74 2d 3e 6d | 65 73 73 61 67 65 20 3e |Event->m|essage >|
|00003290| 3e 20 32 34 29 20 26 20 | 30 78 30 30 30 30 30 30 |> 24) & |0x000000|
|000032a0| 46 46 20 29 09 2f 2a 20 | 73 68 6f 75 6c 64 20 68 |FF )./* |should h|
|000032b0| 61 76 65 20 61 20 63 6f | 6e 73 74 61 6e 74 20 68 |ave a co|nstant h|
|000032c0| 65 72 65 20 2a 2f 0d 09 | 7b 0d 09 09 63 61 73 65 |ere */..|{...case|
|000032d0| 20 73 75 73 70 65 6e 64 | 52 65 73 75 6d 65 4d 65 | suspend|ResumeMe|
|000032e0| 73 73 61 67 65 20 3a 0d | 09 09 09 67 46 72 6f 6e |ssage :.|...gFron|
|000032f0| 74 50 72 6f 63 65 73 73 | 20 3d 20 74 68 65 45 76 |tProcess| = theEv|
|00003300| 65 6e 74 2d 3e 6d 65 73 | 73 61 67 65 20 26 20 72 |ent->mes|sage & r|
|00003310| 65 73 75 6d 65 46 6c 61 | 67 3b 0d 09 09 09 0d 09 |esumeFla|g;......|
|00003320| 09 09 74 68 65 57 69 6e | 64 6f 77 20 3d 20 46 72 |..theWin|dow = Fr|
|00003330| 6f 6e 74 57 69 6e 64 6f | 77 20 28 29 3b 0d 09 09 |ontWindo|w ();...|
|00003340| 09 0d 09 09 09 69 66 20 | 28 20 67 46 72 6f 6e 74 |.....if |( gFront|
|00003350| 50 72 6f 63 65 73 73 20 | 29 0d 09 09 09 7b 0d 09 |Process |)....{..|
|00003360| 09 09 09 2f 2a 20 72 65 | 73 75 6d 65 20 65 76 65 |.../* re|sume eve|
|00003370| 6e 74 20 2a 2f 0d 09 09 | 09 09 0d 09 09 09 09 69 |nt */...|.......i|
|00003380| 66 20 28 20 74 68 65 45 | 76 65 6e 74 2d 3e 6d 65 |f ( theE|vent->me|
|00003390| 73 73 61 67 65 20 26 20 | 63 6f 6e 76 65 72 74 43 |ssage & |convertC|
|000033a0| 6c 69 70 62 6f 61 72 64 | 46 6c 61 67 20 29 0d 09 |lipboard|Flag )..|
|000033b0| 09 09 09 7b 0d 09 09 09 | 09 09 2f 2a 20 63 6f 6e |...{....|../* con|
|000033c0| 76 65 72 74 20 74 68 65 | 20 63 6c 69 70 62 6f 61 |vert the| clipboa|
|000033d0| 72 64 20 2a 2f 0d 09 09 | 09 09 7d 0d 09 09 09 09 |rd */...|..}.....|
|000033e0| 0d 09 09 09 09 73 77 69 | 74 63 68 20 28 20 57 69 |.....swi|tch ( Wi|
|000033f0| 6e 64 6f 77 54 79 70 65 | 28 74 68 65 57 69 6e 64 |ndowType|(theWind|
|00003400| 6f 77 29 20 29 0d 09 09 | 09 09 7b 0d 09 09 09 09 |ow) )...|..{.....|
|00003410| 09 63 61 73 65 20 57 69 | 6e 64 6f 77 5f 6e 6f 6e |.case Wi|ndow_non|
|00003420| 65 20 3a 0d 09 09 09 09 | 09 09 62 72 65 61 6b 3b |e :.....|..break;|
|00003430| 0d 09 09 09 09 09 0d 09 | 09 09 09 09 63 61 73 65 |........|....case|
|00003440| 20 57 69 6e 64 6f 77 5f | 55 4e 4b 4e 4f 57 4e 20 | Window_|UNKNOWN |
|00003450| 3a 0d 09 09 09 09 09 09 | 6d 79 5f 61 73 73 65 72 |:.......|my_asser|
|00003460| 74 20 28 20 6b 46 6f 72 | 63 65 41 73 73 65 72 74 |t ( kFor|ceAssert|
|00003470| 2c 20 22 5c 70 64 6f 4f | 73 45 76 74 3a 20 55 6e |, "\pdoO|sEvt: Un|
|00003480| 6b 6e 6f 77 6e 20 77 69 | 6e 64 6f 77 20 74 79 70 |known wi|ndow typ|
|00003490| 65 22 20 29 3b 0d 09 09 | 09 09 09 0d 09 09 09 09 |e" );...|........|
|000034a0| 09 64 65 66 61 75 6c 74 | 20 3a 0d 09 09 09 09 09 |.default| :......|
|000034b0| 09 57 69 6e 64 6f 77 41 | 63 74 69 76 61 74 65 20 |.WindowA|ctivate |
|000034c0| 28 20 74 68 65 57 69 6e | 64 6f 77 2c 20 74 72 75 |( theWin|dow, tru|
|000034d0| 65 2c 20 74 68 65 45 76 | 65 6e 74 20 29 3b 0d 09 |e, theEv|ent );..|
|000034e0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|000034f0| 7d 0d 09 09 09 09 0d 09 | 09 09 09 2f 2a 20 72 65 |}.......|.../* re|
|00003500| 73 65 74 20 27 71 75 69 | 74 20 6f 6e 20 69 64 6c |set 'qui|t on idl|
|00003510| 65 20 74 69 6d 65 27 20 | 74 69 6d 65 72 20 2a 2f |e time' |timer */|
|00003520| 0d 09 09 09 09 52 65 73 | 65 74 51 75 69 74 49 64 |.....Res|etQuitId|
|00003530| 6c 65 54 69 6d 65 72 28 | 29 3b 0d 09 09 09 7d 0d |leTimer(|);....}.|
|00003540| 09 09 09 65 6c 73 65 0d | 09 09 09 7b 0d 09 09 09 |...else.|...{....|
|00003550| 09 2f 2a 20 73 75 73 70 | 65 6e 64 20 65 76 65 6e |./* susp|end even|
|00003560| 74 20 2a 2f 0d 09 09 09 | 09 2f 2a 20 63 6f 6e 76 |t */....|./* conv|
|00003570| 65 72 74 20 74 68 65 20 | 63 6c 69 70 62 6f 61 72 |ert the |clipboar|
|00003580| 64 2c 20 69 66 20 6e 65 | 65 64 65 64 2c 20 66 6f |d, if ne|eded, fo|
|00003590| 72 20 65 78 70 6f 72 74 | 20 2a 2f 0d 09 09 09 09 |r export| */.....|
|000035a0| 0d 09 09 09 09 73 77 69 | 74 63 68 20 28 20 57 69 |.....swi|tch ( Wi|
|000035b0| 6e 64 6f 77 54 79 70 65 | 28 74 68 65 57 69 6e 64 |ndowType|(theWind|
|000035c0| 6f 77 29 20 29 0d 09 09 | 09 09 7b 0d 09 09 09 09 |ow) )...|..{.....|
|000035d0| 09 63 61 73 65 20 57 69 | 6e 64 6f 77 5f 6e 6f 6e |.case Wi|ndow_non|
|000035e0| 65 20 3a 0d 09 09 09 09 | 09 09 62 72 65 61 6b 3b |e :.....|..break;|
|000035f0| 0d 09 09 09 09 09 0d 09 | 09 09 09 09 63 61 73 65 |........|....case|
|00003600| 20 57 69 6e 64 6f 77 5f | 55 4e 4b 4e 4f 57 4e 20 | Window_|UNKNOWN |
|00003610| 3a 0d 09 09 09 09 09 09 | 6d 79 5f 61 73 73 65 72 |:.......|my_asser|
|00003620| 74 20 28 20 6b 46 6f 72 | 63 65 41 73 73 65 72 74 |t ( kFor|ceAssert|
|00003630| 2c 20 22 5c 70 64 6f 4f | 73 45 76 74 3a 20 55 6e |, "\pdoO|sEvt: Un|
|00003640| 6b 6e 6f 77 6e 20 77 69 | 6e 64 6f 77 20 74 79 70 |known wi|ndow typ|
|00003650| 65 22 20 29 3b 0d 09 09 | 09 09 09 0d 09 09 09 09 |e" );...|........|
|00003660| 09 64 65 66 61 75 6c 74 | 20 3a 0d 09 09 09 09 09 |.default| :......|
|00003670| 09 57 69 6e 64 6f 77 41 | 63 74 69 76 61 74 65 20 |.WindowA|ctivate |
|00003680| 28 20 74 68 65 57 69 6e | 64 6f 77 2c 20 66 61 6c |( theWin|dow, fal|
|00003690| 73 65 2c 20 74 68 65 45 | 76 65 6e 74 20 29 3b 0d |se, theE|vent );.|
|000036a0| 09 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|000036b0| 09 7d 0d 09 09 09 7d 0d | 09 09 09 62 72 65 61 6b |.}....}.|...break|
|000036c0| 3b 0d 09 09 0d 09 09 63 | 61 73 65 20 6d 6f 75 73 |;......c|ase mous|
|000036d0| 65 4d 6f 76 65 64 4d 65 | 73 73 61 67 65 20 3a 20 |eMovedMe|ssage : |
|000036e0| 2f 2a 20 49 4d 2d 4d 54 | 45 3a 20 32 2d 36 32 2d |/* IM-MT|E: 2-62-|
|000036f0| 36 37 20 2a 2f 0d 09 09 | 09 2f 2a 20 79 6f 75 20 |67 */...|./* you |
|00003700| 6d 61 79 20 77 61 6e 74 | 20 74 6f 20 61 64 6a 75 |may want| to adju|
|00003710| 73 74 20 79 6f 75 72 20 | 63 75 72 73 6f 72 20 61 |st your |cursor a|
|00003720| 6e 64 20 6d 6f 75 73 65 | 20 72 65 67 69 6f 6e 20 |nd mouse| region |
|00003730| 68 65 72 65 20 2a 2f 0d | 09 09 09 62 72 65 61 6b |here */.|...break|
|00003740| 3b 0d 09 7d 0d 7d 20 2f | 2a 20 64 6f 4f 73 45 76 |;..}.} /|* doOsEv|
|00003750| 74 20 2a 2f 0d 0d 0d 2f | 2a 20 48 61 6e 64 6c 65 |t */.../|* Handle|
|00003760| 20 27 62 61 64 27 20 64 | 69 73 6b 20 6d 6f 75 6e | 'bad' d|isk moun|
|00003770| 74 73 2e 20 4a 75 73 74 | 20 63 61 6c 6c 20 74 68 |ts. Just| call th|
|00003780| 65 20 73 79 73 74 65 6d | 20 44 49 42 61 64 4d 6f |e system| DIBadMo|
|00003790| 75 6e 74 20 63 61 6c 6c | 2e 0d 09 2d 3e 6d 65 73 |unt call|...->mes|
|000037a0| 73 61 67 65 09 6c 6f 6e | 67 09 64 72 69 76 65 20 |sage.lon|g.drive |
|000037b0| 6e 75 6d 62 65 72 20 69 | 6e 20 6c 6f 77 2d 6f 72 |number i|n low-or|
|000037c0| 64 65 72 20 77 6f 72 64 | 2c 20 66 69 6c 65 20 6d |der word|, file m|
|000037d0| 61 6e 61 67 65 72 20 72 | 65 73 75 6c 74 20 63 6f |anager r|esult co|
|000037e0| 64 65 20 69 6e 20 68 69 | 67 68 2d 6f 72 64 65 72 |de in hi|gh-order|
|000037f0| 20 77 6f 72 64 0d 09 2d | 3e 77 68 65 6e 09 09 6c | word..-|>when..l|
|00003800| 6f 6e 67 09 74 69 6d 65 | 20 77 68 65 6e 20 65 76 |ong.time| when ev|
|00003810| 65 6e 74 20 77 61 73 20 | 70 6f 73 74 65 64 20 28 |ent was |posted (|
|00003820| 69 6e 20 74 69 63 6b 73 | 20 73 69 6e 63 65 20 73 |in ticks| since s|
|00003830| 79 73 74 65 6d 20 73 74 | 61 72 74 75 70 29 0d 09 |ystem st|artup)..|
|00003840| 2d 3e 77 68 65 72 65 09 | 09 50 6f 69 6e 74 09 63 |->where.|.Point.c|
|00003850| 75 72 73 6f 72 20 6c 6f | 63 61 74 69 6f 6e 20 61 |ursor lo|cation a|
|00003860| 74 20 65 76 65 6e 74 20 | 74 69 6d 65 0d 09 2d 3e |t event |time..->|
|00003870| 6d 6f 64 69 66 69 65 72 | 73 09 69 6e 74 09 09 73 |modifier|s.int..s|
|00003880| 74 61 74 65 20 6f 66 20 | 6d 6f 64 69 66 69 65 72 |tate of |modifier|
|00003890| 20 6b 65 79 73 20 61 6e | 64 20 6d 6f 75 73 65 20 | keys an|d mouse |
|000038a0| 62 75 74 74 6f 6e 20 61 | 74 20 65 76 65 6e 74 20 |button a|t event |
|000038b0| 74 69 6d 65 0d 09 49 4d | 2d 4d 54 45 3a 32 2d 35 |time..IM|-MTE:2-5|
|000038c0| 35 2c 35 36 20 2a 2f 0d | 76 6f 69 64 0d 64 6f 44 |5,56 */.|void.doD|
|000038d0| 69 73 6b 45 76 74 20 28 | 20 45 76 65 6e 74 52 65 |iskEvt (| EventRe|
|000038e0| 63 6f 72 64 20 2a 74 68 | 65 45 76 65 6e 74 20 29 |cord *th|eEvent )|
|000038f0| 0d 7b 0d 09 50 6f 69 6e | 74 09 61 50 6f 69 6e 74 |.{..Poin|t.aPoint|
|00003900| 3b 0d 09 4f 53 45 72 72 | 09 74 68 65 45 72 72 3b |;..OSErr|.theErr;|
|00003910| 0d 09 0d 09 2f 2a 20 69 | 66 20 64 69 73 6b 20 6d |..../* i|f disk m|
|00003920| 6f 75 6e 74 20 77 61 73 | 20 75 6e 73 75 63 63 65 |ount was| unsucce|
|00003930| 73 73 66 75 6c 20 2a 2f | 0d 09 69 66 20 28 20 48 |ssful */|..if ( H|
|00003940| 69 57 6f 72 64 28 74 68 | 65 45 76 65 6e 74 2d 3e |iWord(th|eEvent->|
|00003950| 6d 65 73 73 61 67 65 29 | 20 21 3d 20 6e 6f 45 72 |message)| != noEr|
|00003960| 72 20 29 0d 09 7b 0d 09 | 09 2f 2a 20 6c 6f 61 64 |r )..{..|./* load|
|00003970| 20 64 69 73 6b 20 69 6e | 69 74 69 61 6c 69 7a 61 | disk in|itializa|
|00003980| 74 69 6f 6e 20 6d 61 6e | 61 67 65 72 20 2a 2f 0d |tion man|ager */.|
|00003990| 09 09 44 49 4c 6f 61 64 | 20 28 29 3b 0d 09 09 0d |..DILoad| ();....|
|000039a0| 09 09 61 50 6f 69 6e 74 | 2e 76 09 3d 20 31 32 30 |..aPoint|.v.= 120|
|000039b0| 3b 0d 09 09 61 50 6f 69 | 6e 74 2e 68 09 3d 20 31 |;...aPoi|nt.h.= 1|
|000039c0| 32 30 3b 0d 09 09 74 68 | 65 45 72 72 09 09 3d 20 |20;...th|eErr..= |
|000039d0| 44 49 42 61 64 4d 6f 75 | 6e 74 20 28 20 61 50 6f |DIBadMou|nt ( aPo|
|000039e0| 69 6e 74 2c 20 74 68 65 | 45 76 65 6e 74 2d 3e 6d |int, the|Event->m|
|000039f0| 65 73 73 61 67 65 20 29 | 3b 0d 09 09 0d 09 09 2f |essage )|;....../|
|00003a00| 2a 20 75 6e 6c 6f 61 64 | 20 64 69 73 6b 20 69 6e |* unload| disk in|
|00003a10| 69 74 69 61 6c 69 7a 61 | 74 69 6f 6e 20 6d 61 6e |itializa|tion man|
|00003a20| 61 67 65 72 20 2a 2f 0d | 09 09 44 49 55 6e 6c 6f |ager */.|..DIUnlo|
|00003a30| 61 64 20 28 29 3b 0d 09 | 7d 0d 7d 20 2f 2a 20 64 |ad ();..|}.} /* d|
|00003a40| 6f 44 69 73 6b 45 76 74 | 20 2a 2f 0d 0d 23 65 6e |oDiskEvt| */..#en|
|00003a50| 64 69 66 09 2f 2a 20 6b | 43 6f 6d 70 69 6c 65 57 |dif./* k|CompileW|
|00003a60| 69 74 68 46 6f 72 65 67 | 72 6f 75 6e 64 20 2a 2f |ithForeg|round */|
|00003a70| 0d 0d 2f 2a 2a 20 20 49 | 64 6c 65 20 54 69 6d 65 |../** I|dle Time|
|00003a80| 20 20 2a 2a 2f 0d 23 70 | 72 61 67 6d 61 20 6d 61 | **/.#p|ragma ma|
|00003a90| 72 6b 20 2d 0d 0d 2f 2a | 20 0d 09 2d 3e 6d 65 73 |rk -../*| ..->mes|
|00003aa0| 73 61 67 65 09 6c 6f 6e | 67 09 75 6e 64 65 66 69 |sage.lon|g.undefi|
|00003ab0| 6e 65 64 0d 09 2d 3e 77 | 68 65 6e 09 09 6c 6f 6e |ned..->w|hen..lon|
|00003ac0| 67 09 74 69 6d 65 20 77 | 68 65 6e 20 65 76 65 6e |g.time w|hen even|
|00003ad0| 74 20 77 61 73 20 70 6f | 73 74 65 64 20 28 69 6e |t was po|sted (in|
|00003ae0| 20 74 69 63 6b 73 20 73 | 69 6e 63 65 20 73 79 73 | ticks s|ince sys|
|00003af0| 74 65 6d 20 73 74 61 72 | 74 75 70 29 0d 09 2d 3e |tem star|tup)..->|
|00003b00| 77 68 65 72 65 09 09 50 | 6f 69 6e 74 09 63 75 72 |where..P|oint.cur|
|00003b10| 73 6f 72 20 6c 6f 63 61 | 74 69 6f 6e 20 61 74 20 |sor loca|tion at |
|00003b20| 65 76 65 6e 74 20 74 69 | 6d 65 0d 09 2d 3e 6d 6f |event ti|me..->mo|
|00003b30| 64 69 66 69 65 72 73 09 | 69 6e 74 09 09 73 74 61 |difiers.|int..sta|
|00003b40| 74 65 20 6f 66 20 6d 6f | 64 69 66 69 65 72 20 6b |te of mo|difier k|
|00003b50| 65 79 73 20 61 6e 64 20 | 6d 6f 75 73 65 20 62 75 |eys and |mouse bu|
|00003b60| 74 74 6f 6e 20 61 74 20 | 65 76 65 6e 74 20 74 69 |tton at |event ti|
|00003b70| 6d 65 0d 09 49 4d 2d 4d | 54 45 3a 20 32 2d 35 37 |me..IM-M|TE: 2-57|
|00003b80| 2c 35 38 2c 20 36 2d 37 | 39 2c 38 30 20 2a 2f 0d |,58, 6-7|9,80 */.|
|00003b90| 76 6f 69 64 0d 64 6f 49 | 64 6c 65 20 28 20 45 76 |void.doI|dle ( Ev|
|00003ba0| 65 6e 74 52 65 63 6f 72 | 64 20 2a 74 68 65 45 76 |entRecor|d *theEv|
|00003bb0| 65 6e 74 20 29 0d 7b 0d | 09 23 69 66 20 6b 43 6f |ent ).{.|.#if kCo|
|00003bc0| 6d 70 69 6c 65 57 69 74 | 68 46 6f 72 65 67 72 6f |mpileWit|hForegro|
|00003bd0| 75 6e 64 0d 09 57 69 6e | 64 6f 77 50 74 72 09 74 |und..Win|dowPtr.t|
|00003be0| 68 65 57 69 6e 64 6f 77 | 3b 0d 09 73 68 6f 72 74 |heWindow|;..short|
|00003bf0| 09 09 69 74 65 6d 48 69 | 74 3b 0d 09 42 6f 6f 6c |..itemHi|t;..Bool|
|00003c00| 65 61 6e 09 09 74 68 65 | 52 65 73 75 6c 74 3b 0d |ean..the|Result;.|
|00003c10| 09 23 65 6e 64 69 66 0d | 09 0d 09 23 69 66 20 6b |.#endif.|...#if k|
|00003c20| 43 6f 6d 70 69 6c 65 57 | 69 74 68 54 68 72 65 61 |CompileW|ithThrea|
|00003c30| 64 73 4f 70 74 69 6f 6e | 61 6c 0d 09 69 66 20 28 |dsOption|al..if (|
|00003c40| 20 67 48 61 73 54 68 72 | 65 61 64 4d 67 72 20 29 | gHasThr|eadMgr )|
|00003c50| 0d 09 23 65 6e 64 69 66 | 0d 09 7b 0d 09 09 59 69 |..#endif|..{...Yi|
|00003c60| 65 6c 64 54 6f 41 6e 79 | 54 68 72 65 61 64 20 28 |eldToAny|Thread (|
|00003c70| 29 3b 0d 09 7d 0d 09 0d | 09 23 69 66 20 6b 43 6f |);..}...|.#if kCo|
|00003c80| 6d 70 69 6c 65 57 69 74 | 68 51 75 69 74 4f 6e 4c |mpileWit|hQuitOnL|
|00003c90| 6f 6e 67 49 64 6c 65 0d | 09 69 66 20 28 20 67 44 |ongIdle.|.if ( gD|
|00003ca0| 6f 49 64 6c 65 51 75 69 | 74 20 26 26 20 28 67 54 |oIdleQui|t && (gT|
|00003cb0| 69 6d 65 4c 61 73 74 41 | 63 74 69 6f 6e 20 3e 20 |imeLastA|ction > |
|00003cc0| 6e 69 6c 29 20 26 26 0d | 09 09 28 28 67 54 69 6d |nil) &&.|..((gTim|
|00003cd0| 65 4c 61 73 74 41 63 74 | 69 6f 6e 20 2b 20 67 49 |eLastAct|ion + gI|
|00003ce0| 64 6c 65 54 69 6d 65 54 | 6f 51 75 69 74 29 20 3c |dleTimeT|oQuit) <|
|00003cf0| 20 54 69 63 6b 43 6f 75 | 6e 74 28 29 29 20 29 0d | TickCou|nt()) ).|
|00003d00| 09 7b 0d 09 09 67 51 75 | 69 74 20 3d 20 74 72 75 |.{...gQu|it = tru|
|00003d10| 65 3b 0d 09 7d 0d 09 23 | 65 6e 64 69 66 0d 09 0d |e;..}..#|endif...|
|00003d20| 09 23 69 66 20 6b 43 6f | 6d 70 69 6c 65 57 69 74 |.#if kCo|mpileWit|
|00003d30| 68 46 6f 72 65 67 72 6f | 75 6e 64 0d 09 69 66 20 |hForegro|und..if |
|00003d40| 28 20 67 46 72 6f 6e 74 | 50 72 6f 63 65 73 73 20 |( gFront|Process |
|00003d50| 29 0d 09 7b 0d 09 09 74 | 68 65 57 69 6e 64 6f 77 |)..{...t|heWindow|
|00003d60| 20 3d 20 46 72 6f 6e 74 | 57 69 6e 64 6f 77 20 28 | = Front|Window (|
|00003d70| 29 3b 0d 09 09 0d 09 09 | 73 77 69 74 63 68 20 28 |);......|switch (|
|00003d80| 20 57 69 6e 64 6f 77 54 | 79 70 65 28 74 68 65 57 | WindowT|ype(theW|
|00003d90| 69 6e 64 6f 77 29 20 29 | 0d 09 09 7b 0d 09 09 09 |indow) )|...{....|
|00003da0| 63 61 73 65 20 57 69 6e | 64 6f 77 5f 61 62 6f 75 |case Win|dow_abou|
|00003db0| 74 20 3a 0d 09 09 09 63 | 61 73 65 20 57 69 6e 64 |t :....c|ase Wind|
|00003dc0| 6f 77 5f 6e 6f 6e 65 20 | 3a 0d 09 09 09 09 2f 2a |ow_none |:...../*|
|00003dd0| 20 64 6f 6e 27 74 20 64 | 6f 20 61 6e 79 74 68 69 | don't d|o anythi|
|00003de0| 6e 67 20 2a 2f 0d 09 09 | 09 09 62 72 65 61 6b 3b |ng */...|..break;|
|00003df0| 0d 09 09 09 0d 09 09 09 | 63 61 73 65 20 57 69 6e |........|case Win|
|00003e00| 64 6f 77 5f 64 6c 67 4d | 6f 64 61 6c 20 3a 0d 09 |dow_dlgM|odal :..|
|00003e10| 09 09 63 61 73 65 20 57 | 69 6e 64 6f 77 5f 64 6c |..case W|indow_dl|
|00003e20| 67 4d 6f 76 65 61 62 6c | 65 4d 6f 64 61 6c 20 3a |gMoveabl|eModal :|
|00003e30| 0d 09 09 09 09 2f 2a 20 | 49 4d 3a 4d 54 42 20 32 |...../* |IM:MTB 2|
|00003e40| 2d 32 39 2c 33 30 20 2a | 2f 0d 09 09 09 09 74 68 |-29,30 *|/.....th|
|00003e50| 65 52 65 73 75 6c 74 20 | 3d 20 44 69 61 6c 6f 67 |eResult |= Dialog|
|00003e60| 53 65 6c 65 63 74 20 28 | 20 74 68 65 45 76 65 6e |Select (| theEven|
|00003e70| 74 2c 20 28 44 69 61 6c | 6f 67 50 74 72 20 2a 29 |t, (Dial|ogPtr *)|
|00003e80| 26 74 68 65 57 69 6e 64 | 6f 77 2c 20 26 69 74 65 |&theWind|ow, &ite|
|00003e90| 6d 48 69 74 20 29 3b 0d | 09 09 09 09 62 72 65 61 |mHit );.|....brea|
|00003ea0| 6b 3b 0d 09 09 09 0d 09 | 09 09 63 61 73 65 20 57 |k;......|..case W|
|00003eb0| 69 6e 64 6f 77 5f 55 4e | 4b 4e 4f 57 4e 20 3a 0d |indow_UN|KNOWN :.|
|00003ec0| 09 09 09 09 6d 79 5f 61 | 73 73 65 72 74 20 28 20 |....my_a|ssert ( |
|00003ed0| 6b 46 6f 72 63 65 41 73 | 73 65 72 74 2c 20 22 5c |kForceAs|sert, "\|
|00003ee0| 70 64 6f 49 64 6c 65 3a | 20 75 6e 6b 6e 6f 77 6e |pdoIdle:| unknown|
|00003ef0| 20 77 69 6e 64 6f 77 20 | 74 79 70 65 22 20 29 3b | window |type" );|
|00003f00| 0d 09 09 09 0d 09 09 09 | 64 65 66 61 75 6c 74 20 |........|default |
|00003f10| 3a 0d 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 7d |:.....br|eak;...}|
|00003f20| 0d 09 7d 0d 09 23 65 6e | 64 69 66 09 2f 2a 20 6b |..}..#en|dif./* k|
|00003f30| 43 6f 6d 70 69 6c 65 57 | 69 74 68 46 6f 72 65 67 |CompileW|ithForeg|
|00003f40| 72 6f 75 6e 64 20 2a 2f | 0d 7d 20 2f 2a 20 64 6f |round */|.} /* do|
|00003f50| 49 64 6c 65 20 2a 2f 0d | 0d 0d 2f 2a 2a 2a 2a 2a |Idle */.|../*****|
|00003f60| 20 20 45 4f 46 20 20 2a | 2a 2a 2a 2a 2f 0d 00 00 | EOF *|****/...|
|00003f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003f80| 00 00 01 00 00 00 01 74 | 00 00 00 74 00 00 00 52 |.......t|...t...R|
|00003f90| 00 00 2d 86 13 46 6f 72 | 6d 61 74 20 32 20 53 74 |..-..For|mat 2 St|
|00003fa0| 61 74 69 6f 6e 65 72 79 | 00 00 00 00 00 00 00 00 |ationery|........|
|00003fb0| 0b 45 76 65 6e 74 55 74 | 69 6c 2e 63 02 00 00 00 |.EventUt|il.c....|
|00003fc0| 54 45 58 54 43 57 49 45 | 00 04 00 00 00 00 00 00 |TEXTCWIE|........|
|00003fd0| 00 00 54 45 58 54 43 57 | 49 45 00 04 00 00 00 00 |..TEXTCW|IE......|
|00003fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ff0| 00 00 aa 20 d7 0b 00 00 | 00 00 00 00 01 c6 00 00 |... ....|........|
|00004000| 00 00 00 00 00 00 00 00 | 00 00 06 79 25 00 00 00 |........|...y%...|
|00004010| 2d 96 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |-.......|........|
|00004020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004030| 00 00 00 00 06 7a 25 00 | 00 00 2d 96 10 50 41 4e |.....z%.|..-..PAN|
|00004040| 54 4f 4e 45 a8 20 2d 20 | 53 65 69 6b 6f 00 00 00 |TONE. - |Seiko...|
|00004050| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 06 a0 |........|........|
|00004060| 25 00 00 00 2d ed 07 68 | 65 61 64 65 72 73 00 00 |%...-..h|eaders..|
|00004070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004080| 00 00 00 1c 01 01 ff ff | ff ff ff ff 00 00 06 40 |........|.......@|
|00004090| 00 01 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000040a0| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 00 00 00 |...H..Mo|naco....|
|000040b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000040c0| 00 00 00 00 00 00 00 03 | 00 04 00 57 00 03 01 d0 |........|...W....|
|000040d0| 02 42 00 57 00 03 01 d0 | 02 42 ad 2d d3 8f 00 00 |.B.W....|.B.-....|
|000040e0| 00 00 00 00 00 00 00 00 | 00 00 01 00 00 00 00 04 |........|........|
|000040f0| 00 01 00 01 00 00 01 00 | 00 00 01 74 00 00 00 74 |........|...t...t|
|00004100| 00 00 00 52 00 d2 79 20 | 15 4e 00 00 00 1c 00 52 |...R..y |.N.....R|
|00004110| 00 01 4d 50 53 52 00 01 | 00 12 4d 57 42 42 00 00 |..MPSR..|..MWBB..|
|00004120| 00 2a 27 10 ff ff 00 00 | 00 00 00 00 00 00 03 ed |.*'.....|........|
|00004130| ff ff 00 00 00 20 00 00 | 00 00 03 f0 ff ff 00 00 |..... ..|........|
|00004140| 00 6c 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.l......|........|
|00004150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+